Multiple image subtractions that is comming from live camera

I am capturing multiple images with the help of live camera and save into a file.Now i want to substract multiple images that is comming from live camera and store into a file.How is it possible in matlab and code.Thank You in advance.

Respuestas (1)

KSSV
KSSV el 18 de Sept. de 2018
Let I1 and I2 be the image data obtained by using imread. Assuming they are of same dimensions:
I = I1-I2 ;

7 comentarios

imsubtract effectively does the same thing, but can be more efficient as it has built in calls to intel graphics routines for this purpose that can take advantage of hardware.
piku mandal
piku mandal el 18 de Sept. de 2018
Editada: piku mandal el 18 de Sept. de 2018
KSSV,i want with in a loop. so how it possible? I dont want only substract 2 frames but also want to substract multiple frames with in a loop That i saved in a folder.
KSSV
KSSV el 18 de Sept. de 2018
Say you have 10 images,,,,you want to subtract all these images? And get one image?
R = 0 * I1; %same size and data type as I1 but all 0
for K = 1 : numel(I1); R(K) = I1(K) - I2(K); end
piku mandal
piku mandal el 18 de Sept. de 2018
Editada: Walter Roberson el 18 de Sept. de 2018
for i=1:2(% for 2 frames)
frame=getsnapshot(obj); (%taking snapshot from live camera and this is 1st frame)
frame_pre=frame; (% keep it into previous frame)
if i~=1
frame_next=frame+1;(% next frame)
sub_tracted_frame=imsubtract(frame_pre,frame_next);
imshow(sub_tracted_frame);
end
end
but why not working.... the resultant figure is whole blank and not shown as a matrix
obj = videoinput('macvideo', 1); %use winvideo for Windows
obj.ReturnedColorSpace = 'rgb'; %you might need this
%then
for i=1:2 % (for 2 frames)
frame=getsnapshot(obj); %(taking snapshot from live camera and this is 1st frame)
if i~=1
sub_tracted_frame=imsubtract(frame, frame_pre);
imshow(sub_tracted_frame);
drawnow();
end
frame_pre = frame;
end
Thank You Walter Roberson, sir.

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB Support Package for IP Cameras en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 18 de Sept. de 2018

Comentada:

el 20 de Sept. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by