How to obtain 16-bit grayscale images from a monochrome UVC camera
Dear Igor Pro community,
I tried to acquire 16-bit images using a 16-bit monochrome UVC camera on IgorPro (Version: 9.0.5.1 (Build 56551), windows 10), but the pixel format specification did not work.
I tried to work with an industrial UVC camera, DMK33UX273(The Imaging Source), which supports 8-Bit Monochrome, 12-Bit Packed Monochrome, and 16-Bit Monochrome pixel formats.
Is there any way to get a 16-bit grayscale image from a monochrome UVC camera with 16-bit grayscale?
First, the following command is used
GetCamera availableCameras
results in the following
"DMK 33UX273".
After that, run
NewCamera /N=MyCamera hardwareName="DMK 33UX273"
and then
At this point, the camera image is displayed in real time on IgorPro.
Wave output was also confirmed by the command
ModifyCamera /W=MyCamera capture
However, it is unsigned 8-bit 3-layer data.
In order to drive 12-bit and 16-bit data, it is necessary to set the pixel format appropriately.
GetCamera /def viewfinderPixelFormats; print S_info
The result is "ViewFinderPixelFormats:;".
The conclusion was that there is no corresponding pixel format.
Next, the following command was executed
ModifyCamera /W=MyCamera setPixelFormat="Format_Y16"
also returned the error message
"Failed to configure preview format" error.
I selected various other pixel formats with the same result.
ARGB32, ARGB32_Premultiplied, RGB32, RGB24, RGB565, RGB555, ARGB8565_Premultiplied, BGRA32, BGRA32_Premultiplied, BGR32, BGR24, BGR565, BGR555 BGRA5658_Premultiplied, AYUV444, Format_AYUV444_Premultiplied, YUV444, YUV420P, YV12, UYVY, YUYV, NV12, NV21, Format_IMC1, Format_IMC2, Format_IMC3 Format_IMC3, Format_IMC4, Format_Y8, Format_Y16, Format_Jpeg, Format_CameraRaw, Format_AdobeDng, Format_User
All of these will probably result in an error.
The same results were obtained with a MacbookPro HD camera.
If this can be done, we expect that IgorPro will be easier to use for image recording applications.
On the other hand, if this is not possible, we will have to consider XOP, which will be very depressing....
My first guess ...
Have you contacted the vendor to confirm that the camera supports the sub-commands to get and set pixel formats? Have you tested the vendor provided software to assure that you can capture with other file formats?
December 10, 2023 at 10:27 am - Permalink
In general, camera support in IP7-IP9 depends on Qt which documents support for various pixel formats that (in our experience) are not supported in real-world applications.
If the image is saved as a 3D wave, Igor sees your camera as producing RGB data. As you may have noticed, the documentation mentions only one pixel format that supports 16-bits/pixel. If you can't get your driver to deliver images in Y16 format, there is little hope of getting 16-bit images using NewCamera/ModifyCamera and you should look for an XOP that supports the specific driver that you are using.
A.G.
December 11, 2023 at 08:56 am - Permalink
In reply to In general, camera support… by Igor
The next choice is See3CAM_20CUG. This camera clearly states that it supports only Y16 and Y8. However, in the end, the acquisition of 16-bit gray images failed. The preview screen opens, but no image is displayed, and the result is even worse.
See3CAM_20CUG
•NewCamera /N=MyCamera hardwareName="See3CAM_20CUG"
Failed to configure preview format
•getCamera /DEF viewfinderPixelFormats
•print S_info
In contrast, the output results in
ViewFinderPixelFormats:;
and
ModifyCamera /W=MyCamera0 setPixelFormat="Format_Y16"
results in
Failed to initialize camera
I cannot get or set a list of pixel formats for any of the UVC cameras I have, and I suspect that Qt's pixel format-related functionality is practically unimplemented. In other words, Qt accepts only 24-bit RGB images by default and cannot be changed from the default format. As a result, only cameras with 24-bit RGB output can display the images, so I thought that this camera, which outputs only Y8 and Y16, not RGB, cannot display the images.
I think that this may be a bug.
December 14, 2023 at 03:58 pm - Permalink
In reply to My first guess ... Have you… by jjweimer
The camera vendor was told that in UVC mode, grayscale is expressed in 8 bits each of RGB. I have another camera, so I will try that one, which only supports Y8 and Y16.
December 14, 2023 at 04:34 pm - Permalink
Sorry, when this is completely out of place from not understanding the problem at all. But in your original post you write that you get 3-layer 8 bit output from your camera. Could it be that the 16 bit greyscale information is somehow retained in there and it is only a matter of reformatting the data? Or are these 3 layers only a copy of the same 8 bit data?
December 14, 2023 at 05:55 pm - Permalink
Based on the limitations mentioned at https://doc.qt.io/qt-5/qtmultimedia-windows.html#limitations, none of what you are describing is surprising. AG wrote the NewCamera/ModifyCamera operations to wrap the camera API provided by Qt with the knowledge that some or much of that API was not fully implemented, at least on some platforms.
December 15, 2023 at 08:47 am - Permalink