Why I get the background in white color while it should be black !
Afficher commentaires plus anciens
Hi ..
I have the following code:
vid = videoinput('winvideo',1);
set(vid, 'ReturnedColorspace', 'rgb');
% set(vid,'FramesPerTrigger',4);
set(vid,'TriggerRepeat',Inf);
vid.FrameGrabInterval = 6;
start(vid);
BackgroundImage = getsnapshot(vid);
I1 = rgb2gray(BackgroundImage);
figure;
subplot(3,3,1);
imshow(I1);
title('Background F1');
while 1
frames = getsnapshot(vid);
subplot(3,3,2);
imshow(frames);
title('RGB frames');
I2 = rgb2gray(frames);
subplot(3,3,3);
imshow(I2);
title('Gray frames');
Objects = I1 ~= I2;
subplot(3,3,4);
imshow(Objects);
title('Objects');
end
In this part of code should give me a black background and the objects should be white
Objects = I1 ~= I2;
subplot(3,3,4);
imshow(Objects);
title('Objects');
but I get white background ! when I tried it on images it was work just fine :|
Could you please help me
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Video Formats and Interfaces dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!