This is my code:
for x = 1:10
img = getsnapshot(vid); R = img(:,:,1); G = img(:,:,2); B = img(:,:,3); a = find(R>90 & R<157 & G>0 & G<100 & B>0 & B<81); BW=zeros(480,640); BW(a)=1; imshow(BW)
No products are associated with this question.
Change your two lines
BW = double(a);
This would produce exactly the same matrix as you are now producing.
You might possibly get slightly better graphics performance with uint8 instead of double, but you'd want to time carefully to be sure. For that,
BW = uint8(255) .* uint8(a);
BW = uint8( 255 .* a );
or perhaps even
T = uint8([0 255]); BW = T(1 + a);