Camera index number

426 views
Skip to first unread message

Al Yard

unread,
Feb 15, 2017, 9:37:09 PM2/15/17
to OpenPnP
Hi Jason,

Would it be practical to allow us the choice to select the camera either by it's index number or by it's filename?  I am running on Linux, and I can set a persistent filename (using udev rules) to each camera, but this doesn't make the index number persistent.

Thanks,

Al

Jason von Nieda

unread,
Feb 15, 2017, 9:55:05 PM2/15/17
to OpenPnP
Hi Al,

Do you know if OpenCV supports this? I know that you can open a capture device with a filename, but I thought it was only for opening video files, not cameras.

Related: Indexes typically only change when you change ports. If you plug the same cameras into the same ports the indexes will remain constant.

Jason


--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/821975f7-eb7a-480e-8a04-dd068ae5f1b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Al Yard

unread,
Feb 15, 2017, 11:00:44 PM2/15/17
to OpenPnP
Hi Jason,

I'm not an expert on OpenCV .... I'm just learning it.  But when I look in the reference, I see the VideoCapture::open() function is overloaded, it accepts both indexes and filenames.

I agree, the indexes should remain the same if the cameras are always plugged in the same port.  But my computer sits on a rolling table and gets disconnected from the PnP to run the CNC and other things.  I don't always manage to get the cameras in the same USB ports.

I hope to help out a bit on small fixes/improvements in the future ..... but I'm still not up speed on the OpenPnP code base.  (.... and still a bit fuzzy on Git too!)

Al
Message has been deleted

Cri S

unread,
Feb 15, 2017, 11:36:08 PM2/15/17
to OpenPnP
The filename on CV:open is for video files and it use different back end camera.
Message has been deleted

Jason von Nieda

unread,
Feb 16, 2017, 9:17:14 AM2/16/17
to ope...@googlegroups.com
Hi Al,

As Cri confirmed later down, that call is for opening video files, it won't work for cameras. 

I'm not going to put too much more effort in improving the OpenCvCamera right now. I'm in the process of writing a new camera implementation which will provide native access on all three major platforms and I expect this to replace OpenCvCamera eventually. The purpose of the new code is to solve all these weird problems with capturing with OpenCV.

More information about that effort is here: https://github.com/openpnp/openpnp/issues/448

Jason


Al Yard

unread,
Feb 16, 2017, 11:30:33 PM2/16/17
to OpenPnP
Hi Jason,

O/K .... not a big deal .... I just have to get better organized and plug in the USB cables in the correct order! 

I look forward to your new camera libs.  By the sounds of it, they should work much better.

Al

Jason von Nieda

unread,
Feb 16, 2017, 11:31:48 PM2/16/17
to OpenPnP
Hi Al,

I recommend just sticking a label on each cable. Low tech, but it works :)

Jason


Reply all
Reply to author
Forward
0 new messages