i hav 384 images.using a for loop i read an img& apply transform on it & store the result in variable named res1 & next i read 2nd img & apply transform on it & store result in variable res2 &so on for rest images.how do i implement this in for loop
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
for i=1:384 %read 1st img. apply transform on it and store result in variable named result1. %during next iteration,read 2nd img,apply transform on it and store result in variable named result2. %similarly for rest images store result in variables names result3,result4,... and so on. % how do i implement this end
0 Commenti
Risposte (2)
Image Analyst
il 6 Dic 2013
See the FAQ for code examples: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
0 Commenti
Alex Taylor
il 6 Dic 2013
Modificato: Alex Taylor
il 6 Dic 2013
This concept of storing each result in a separate named variable is not very "MATLAB-like". It would be more in model to represent this operation as an MxNx384 matrix as input, with an PxQx384 matrix as output.
If by "transform" you mean a geometric transformation, then the good news is you don't need to write a loop to do this, provided you can have all 384 images represented in memory as an MxNx384 matrix.
Take the following example:
I = imread('peppers.png');
tform = affine2d([1 0 0; .5 1 0; 0 0 1]);
J = imwarp(I,tform);
figure, imshow(I), figure, imshow(J)
The Image I is an MxNx3 RGB image. The reason that J is an RGB sheared version of I is that when a 2-D geometric transformation is applied to an N-D matrix, imwarp applies the 2-D transformation to I one plane at a time.
This plane at a time behavior is featured in several other Image Processing Toolbox functions including imfilter, imerode, imdilate, etc. You should not need to write a loop to accomplish this task.
0 Commenti
Vedere anche
Categorie
Scopri di più su Geometric Transformation and Image Registration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!