Capture image from webcam on mouse click.
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I am trying to capture image from a webcam. The image snapshot has to be taken after a mouse click. I want to have a click button on preview screen. Can anyone help me do this? Below part is my code to capture image from webcam.
% webcam capture
cam1 = webcam('FaceTime');
preview(cam1);
pause(5);
img = snapshot(cam1);
closePreview(cam1);
imshow(img);
clear('cam1');
댓글 수: 0
채택된 답변
Abhinav Gurram
2016년 11월 11일
편집: Abhinav Gurram
2016년 11월 11일
Taking a snapshot of an image upon a button click can be achieved in the following two ways:
1.Create a simple appdesigner application with the above code, and a button. Associate a callback function to the button, that gets executed when this button is clicked, and captures the snapshot. See app_ex for a simple appdesigner application example.
2. Another way to achieve this is by using the Image Acquisition Toolbox's Image Acquisition Tool.This tool provides a GUI and helps preview, configure, acquire, and save image data. The Image Acquisition tool can be accessed by using the 'imaqtool' command or by selecting Image Acquisition on the Apps tab. Visit Imaqtool to know more about how to use the Image Acquisition tool.
Hope this helps!
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Acquisition Support Packages for Hardware Adaptors (Generic Video Interface)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!