PDA

View Full Version : Python and OpenCV camera settings



Zac Diggum
September 29, 2015, 15:07:07
Hi there,

I'm developing a Python application using OpenCV handling my DMM 24UP031-ML. I'm able to set basic capture properties like resolution and exposure time. However, I'd like to grab frames in 12bit instead of 8bit. Any idea how to do that from within Python and/or OpenCV? If there's a way like interfacing to the Imaging Source C library and calling some 'change depth to 12bit' function, I'd be happy to give it a try.
Also, are there plans to develop a Python SDK or full OpenCV support for your products in the near future?

Thanks in advance...

Stefan Geissler
September 29, 2015, 15:30:43
Hello

How do you set the 8 bit video format in python?

Zac Diggum
September 29, 2015, 15:45:29
I don't, it's the default setting. When I query a new frame it gives me an 'RGB image' which I then convert to grayscale. I know the camera is monochromatic. The original image I get from the camera is 3 channels, 8 bit.
How would I set the mode to 12 bit with your C library? It's possible to call C and C++ functions from within Python. Is there someone at The Imaging Source developing in Python and OpenCV who could give some advice?

Stefan Geissler
September 29, 2015, 15:51:23
Using the 12/16 bit with IC Imaging Control is a very simple task.

Using this with OpenCV... I do not know, I would have to ask the OpenCV support.

Do you work in Windows or Linux?

Zac Diggum
September 30, 2015, 13:09:57
I don't set the bit depth. 8 bit is the default setting I guess. When I grab a frame from the camera I get a 3 channel 'RGB' image although the camera itself is monochromatic. The channels are 8 bit. Isn't there someone at the Imaging Source who does a little Python/OpenCV and could give advice?

Stefan Geissler
September 30, 2015, 15:36:14
I asked for the operating system you use.

Also, I must admit, I am not as experienced in OpenCV to give qualified support for it. I am very sorry for this. However, may be other forum users know, how to handle OpenCV.

However, searching in the internet for "OpenCV set video format" leads to:
http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html

There is:
VideoCapture::set

with the constant "CV_CAP_PROP_FOURCC"

The fourcc to pass could be "Y16", but I am not sure about this.
http://www.fourcc.org/y16/

Zac Diggum
September 30, 2015, 19:17:50
Hello Stefan,

thanks for your help. Setting the fourcc might do the trick. I'll try that out. BTW, I'm on Win7 64 at the moment but the app should be platform independent once it's finished.

So I guess there's no plan for a Python or OpenCV SDK from The Imaging Source? I mean, both are quite popular. Wouldn't give your software engineers much trouble to put something together...

Anyway, thanks again.

Stefan Geissler
October 1, 2015, 09:26:46
Hello


BTW, I'm on Win7 64 at the moment but the app should be platform independent once it's finished.

That will be funny, because the cameras may work different on Linux. On Mac OSx they can not be used at all, because the Mac driver does not now Y800 and Y16.


So I guess there's no plan for a Python or OpenCV SDK from The Imaging Source? I mean, both are quite popular. Wouldn't give your software engineers much trouble to put something together...

That is correct. Python matters more on Linux than on Windows and in Linux we rely on GStreamer. We do not provide own software for Linux, except some nice pipeline modules.

For Windows, it is easy to forward the IC Imaging Control ImageBuffer to an OpenCV IplImage or MAT structure.

Therefore, there is no need for an OpenCV SDK.

Zac Diggum
October 1, 2015, 12:47:41
Hi Stefan,

concerning Linux compatibility, the docs say >The Imaging Source USB 3.0 cameras run out of the box on Linux. No further software or configuration is required.< :-)
For Windows, I think I'll dive into the C++ SDK.

Thank you for your help.

Stefan Geissler
October 1, 2015, 13:49:37
USB 3.0 cameras run out of the box on Linux. No further software or configuration is required.

Absolutely correct. Question is only, how does OpenCV react on this? However, GStreamer is here easy to use in Linux.