show a simple rectangle

i just need to show a rectangle(square) with any color in a camera videostream, then i need to crop the snapshot according inside the rectangle in the video (size 180x200), can you guys help me? here are the few codes been working:
vid = videoinput('winvideo', 1, 'YUY2_320x240');
preview(vid);
for ii=3:-1:1
pause(1);
end
img = getsnapshot(vid);
figure,imshow(img);
BW = imcrop(img,[75 68 180 200]);
imshow(BW);
thank you!!

답변 (1개)

Image Analyst
Image Analyst 2011년 12월 10일

0 개 추천

Did you try "hold on" and rectangle() to show the rectangle over your live video? Your code seems to go live for just two seconds and then snap, crop, and display an image. What is the problem you are having?

댓글 수: 3

Izzo
Izzo 2011년 12월 11일
i just want to display a rectangle with 180x200 size in my live video then snap and crop it, that is all
Jan
Jan 2011년 12월 11일
And what is the problem you are having?
Izzo
Izzo 2011년 12월 11일
the problem is i cant do it, i just asking for someone who might knows

댓글을 달려면 로그인하십시오.

질문:

2011년 12월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by