Capturing an image from the camera at a certain position

6 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Image Analyst
Image Analyst el 25 de Mayo de 2015
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 comentarios
Nour Mawla
Nour Mawla el 25 de Mayo de 2015
I need to call who? Do you mean call the function or phone call someone?
Image Analyst
Image Analyst el 25 de Mayo de 2015
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.

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 25 de Mayo de 2015
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.

Categorías

Más información sobre MATLAB Support Package for IP Cameras en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by