Capturing an image from the camera at a certain position
6 次查看(过去 30 天)
显示 更早的评论
Good afternoon everyone
For the code I'm creating I need to focus the camera on a certain position, only that position should appear while previewing and finally capture only that specific position
The function that I wrote and did 80% of what I need is the following:
handleToAxes = axes();
hImage = image(zeros(640,360,'uint8'));
axis vis3d;
axis off;
videoObject = videoinput('winvideo', 1);
pause (1)
x=getsnapshot(videoObject);
imshow (x)
What the following code does is only show the part of the camera that I need to appear which is perfect....however when capturing the snapshot....the image that would appear is that taken from the whole camera and not just the axis I need...
Note that I can neither crop the image nor open the preview of the camera while executing this part of the function for technical purposes in my overall code
Any help and suggestions would be really appreciated...thank you
0 个评论
采纳的回答
Image Analyst
2015-5-25
I have no idea what you're asking. It's like you're saying you set up the camera (aim, focus, field of view, exposure, etc.) to show exactly what you want to capture, and then you say that it's not capturing what you want. You say the image is "taken from the whole camera and not just the axis I need" - well, what the heck does that mean? If you don't want that view, then why did you set it up like that? Then, aim the camera along the axis you need.
4 个评论
Image Analyst
2015-5-25
Call the Mathworks and ask them how to make your live video "shrink to fit" your live image window instead of displaying "pixel for pixel", which will crop it.
更多回答(1 个)
Walter Roberson
2015-5-25
getsnapshot() applies to the video object directly, not to how it is displayed on the screen in a plot window.
If you were using a GigE camera you could (generally speaking) tell it to adjust the position and focus before your snapshot() it.
My understand is that with winvideo, in order to get the camera itself to change parameters, you may need to use Active X (COM objects). But in your situation, you might be able to alter the ROIPosition of the video input object.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Support Package for IP Cameras 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!