필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
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

답변 (2개)

Image Analyst
Image Analyst 2013년 12월 6일

Alex Taylor
Alex Taylor 2013년 12월 6일
편집: Alex Taylor 2013년 12월 6일
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.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by