Subtract average image from a series of images
이전 댓글 표시
I'm having some difficulty subtracting an averaged image from a series of images from which the average was obtained. The images have been obtained from a MP4 video file.
This is what i have done:
Ven23 = VideoReader('MyVideo23.MP4'); %Read in the video file
Ven23frame1 = read(Ven23,1); % Read in the first frame of the video
sumImage23 = im2double(Ven23frame1); %Double the accuracy of the frame
for i=2:30
Ven23Frames= read(Ven23,i);
sumImage23 = sumImage23 + im2double(Ven23Frames);
end
avgVen23= imshow(sumImage23/30);
This all seems to work; I get an image which looks like the average. However, whenever I try to subtract this average image from any particular frame from the video I get this error:
Undefined operator '-' for
input arguments of type
'matlab.graphics.primitive.Image'.
Then I tried to save the average image and frames as bmp files, load them back in and subtract them. Doing this just returns a black screen. I also tried doubling the accuracy of the reloaded images to no avail.
I'm obviously doing something wrong and I would be grateful if anyone could point it out to me. Thanks.
댓글 수: 3
Image Analyst
2016년 3월 2일
You forgot to show the line of code that generated the error! What does this show:
whos avgVen23
And did you use im2double on the image you're going to subtract from also?
N B
2016년 3월 2일
N B
2016년 3월 3일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!