Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

YUV 4:2:2 to Labview Image Data Type

Solved!
Go to solution

I asked this same question in the labview board.  Sorry for double posting, but I figured maybe this is the correct spot for an answer:

 

I am acquiring images from a Basler scA640-70gc Scout camera.  When I was first working with it, I had everything setup using the labview image data type, and I was getting images no problem.  However, I wasn't getting the frame rate I needed using the standard controls.  So I switched to the low level IMAQdx VI that would get me the raw data.  That got my frame rate up to 70fps.  The low level call (IMAQdx Get Image Data.vi) gives me an array of U8 values.  The camera is working in YUV 4:2:2 format, and IMAQdx seems to have the ability to convert this pixel information into the labview data type when I use the standard calls.  But nothing is jumping out at me when I search the vision palettes for something to type cast the data in an image data type.  Is there a subVI I am missing that does this conversion, or does somebody have a function built that will convert it?  I will gladly store the data as an array, but when I need to put something on screen for the user, I need to get it switched into the image data type so I can use the vision tools on it.  Thanks.

0 Kudos
Message 1 of 4
(4,982 Views)

Hello,

I've found that your camera is able to output these formats: 

 

Mono 8  ( = DCAM Mono 😎

Bayer BG 8  ( = DCAM Raw 😎

Bayer BG 16  ( = DCAM Raw 16)

Bayer BG 12 PackedYUV 4:2:2

Packed  ( = DCAM YUV 4:2:2)

YUV 4:2:2 (YUYV) Packed$

 

Your problem seems to be that when your tries to output color image, you don't reach the max framerate. I think when you're in Bayer, the images are three times bigger to transfer than in Mono (because you have three channels R,G,B) So what I suggest is to select Mono 8 mode, and to apply Bayer filter with the computer. You can find bayer function in the vision palette "IMAQ Bayer Color Decode.vi"

Hope this help.

NTA_LabView_certified_Developper.jpg
0 Kudos
Message 2 of 4
(4,974 Views)
Solution
Accepted by topic author biographie

A little clarification might be needed here...

 

Unless your pixel format is "RGB", then the image transfer speed is identical between saw Mono8 and BayerBG 8 (they both are 8-bits per raw pixel and any conversion happens on the host). The YUV formats are going to be larger in size than the 8-bit formats (because you have 2 bytes per pixel), but identical in size to the Bayer BG 16 format. However, the Basler Scout camera in question should have no prob;em reaching full sensor rate on YUV format.

 

It sounds as though the original problem was that the cost of image conversion was high. Getting the data in raw format and then converting it should not be any faster than having IMAQdx do this internally. In fact we use optimized MMX/SSE routines for the YUV conversion that should make it very fast. Even if you could make a conversion routine that was faster you'd have additional overhead of data movement that would likely offset any gains.

 

I would not expect that the overhead of image conversion for the 70fps VGA camera you specified would be enough to keep you from acquiring at full frame rate. Are you sure when you adjusted your program to get the raw data you did not change anything else like the buffer mode? If you put the equivalent low level VI that also does the decode does still how the problem?

 

Eric

Message 3 of 4
(4,963 Views)

You were right.  I got looking at my code after you made the comment that I may have changed some things, and that is what is messing me up.  I went back and check over all the attributes and such and found my problem.  Now i am getting color images at the 70fps rate.  I feel silly.

 

0 Kudos
Message 4 of 4
(4,959 Views)