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 1frames = 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
Best Answer