Camera preview shows with webcam objects but does not with imaqtool or videoinput

14 Ansichten (letzte 30 Tage)
I am using a Leopard IMX490 GMSL2 camera through their UVC compliant USB3.0 interface.
Using webcam objects, I can connect to the camera and view video using preview() and snapshot().
>> cam = webcam
cam =
webcam with properties:
Name: 'LI-IMX490'
AvailableResolutions: {'2896x1876' '2896x1872'}
Resolution: '2896x1876'
Zoom: 0
Tilt: 0
Gain: 16
Pan: 0
ExposureMode: 'manual'
Focus: 0
Exposure: -2
However, when I try to use videoinput() and getsnapshot(), I get the following error:
>> vid = videoinput('winvideo')
Summary of Video Input Object Using 'LI-IMX490'.
Acquisition Source(s): input1 is available.
Acquisition Parameters: 'input1' is the current selected source.
10 frames per trigger using the selected source.
'YUY2_2896x1872' video data to be logged upon START.
Grabbing first of every 1 frame(s).
Log data to 'memory' on trigger.
Trigger Parameters: 1 'immediate' trigger(s) on START.
Status: Waiting for START.
0 frames acquired since starting.
0 frames available for GETDATA.
>> start(vid)
>> img = getsnapshot(vid);
Error using imaqdevice/getsnapshot (line 65)
A timeout occurred during GETSNAPSHOT.
When I try to use imaqtool, I only get a white box with a red "X" in the preview window. I am also unable to release the camera using delete(vid) or clear vid after I have attempted to open the camera with videoinput or imaqtool and I have to power cycle the camera to connect to it again.
Is there a step I am missing here?

Antworten (1)

Rishabh Singh
Rishabh Singh am 30 Nov. 2021
Issue you are facing can be caused due the incorrect "image acquisition adaptor". Currently you are using 'winvideo' might not support your specific hardware. You can check for installed adaptors using command "imaqhwinfo" and could try other adaptors available on "Add-on Explorer".
One more possible cause could be the "webcam" object created by you, as both might be trying to access the hardware at the same time. If that is the case consider deleting the "cam" object.
Alternatively you can try,
cam = webcam;
img = snapshot(cam);
Hope this helps.
  1 Kommentar
Yoonki Park
Yoonki Park am 30 Nov. 2021
Thank you for your suggestions Rishabh.
My understanding of UVC complient cameras is that they should work with 'winvideo' since they also show up with the Windows 10 Camera app.
I have been careful to power cycle the camera and reboot MATLAB everytime I try a new connection command just in case the hardware is not released by another application or function.
As mentioned in my question, snapshot(cam) does give me an image but I would prefer to use the IMAQ workflow to script image capture and processing from this camera.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by