Linear operation on images

조회 수: 1 (최근 30일)
NITHIN BHARADWAJ
NITHIN BHARADWAJ 2012년 3월 25일
Hey people, I'm trying to add multiple frames to form a single image using the linear operation on images in Matlab. How can I use the "for loop" to add these frames by generally specifying the file names?

답변 (1개)

Image Analyst
Image Analyst 2012년 3월 26일
Try this (untested);
counter = 0;
for f = 1 : numberOfFrames
% Get the filename of the next image (somehow).
fullFileName = GetFileName(f); % You write this, of course.
if exist(fullFileName, 'file')
imageArray = imread(fullFileName);
if f == 1
sumImage = single(imageArray);
else
[rowsS columnsS numColorChannelsS] = size(sumImage);
[rowsF columnsF numColorChannelsF] = size(imageArray);
if rowsS == rowsF && columnsS == columnsF && numColorChannelsS == numColorChannelsF
% Sizes match -- it's okay to sum it.
sumImage = sumImage + single(imageArray);
else
% Sizes don't match. Skip it.
uiwait(msgbox('Sizes don't match'));
continue;
end
end
counter = counter + 1;
else
continue; % Image doesn't exist.
end
end
meanImage = sumImage ./ counter;
imshow(meanImage);
  댓글 수: 1
NITHIN BHARADWAJ
NITHIN BHARADWAJ 2012년 3월 27일
If I were to have frames from 1 to 100 ,how do I feed them all at once into Matlab?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by