Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ flatten image to string 64 bit version

Solved!
Go to solution

Hi,

I noticed odd behavour in "flatten image to string" vision function on labview 64 bit edition. In my program I use flatten image to string (with compress to JPEG and type of flatten Image) to compress and send the data to another application. I noticed color missmatch on the compressed image. Say I have red (255,0,0) 32bit RGB image and I flatten it to string and then save that string as JPEG file using Write to binary vi. When I open the file the picture is blue (0,0,255). It doesen't matter how the data are written (big-endian, little-endian or native) the result is always the same. On 32 bit edition Labview the code worked correctly.

I reported a bug to NI and I'm still waiting for a solution to this problem.

 

labview: labview professional development system 2010 v10.0f2 32/64 bit (with vision development module) fully updatet

 

Tested systems: labview 64bit on windows 7 64bit -> flatten image to string -> false colors

                         labview 32bit on windows 7 64bit -> flatten image to string -> colors OK

                         labview 32bit on windows 7 32bit -> flatten image to string -> colors OK

 

Attached is an image of the block diagram that I used to test conversion.

 

Cheers

Message 1 of 4
(4,447 Views)
Solution
Accepted by topic author 3DVision

Hi 3DVision,

 

I think I see the problem... you code looks like it expects that the output of "flatten image to string" is actually going to be a JPG file as a string, because you selected to use JPG compression in the options. However, that is not the way that VI is intended to be used. It is simply a way for converting a Vision image type into a string representation that can be easier to transport around (such as over the network, to a user's own file format, etc). It is a parallel to the normal "flatten" that can be used on any LabVIEW datatype. The format of this string is proprietary and has provisions for storing information that is specific to Vision images that cannot be represented in normal image file formats (overlay information, calibration info, custom data, etc). If you are saving the flattened string to a file and expecting to open it as a normal JPG file it is unlikely to work properly. The only way it would be guaranteed to work is if you pass it to the corresponding "unflatten from string" VI. I'm not sure why it is working in 32-bit mode, but it sounds like a lucky fluke.

 

For your use case, you likely want to use the "IMAQ Write String" VI. This is intended to give a resulting string that is identical to the file format specified.

 

Eric

Message 2 of 4
(4,425 Views)

Hi,

 

Tnx for your answer. The solution you proposed solved the problem tnx. However it is still odd that a function of same version of labview 32bit / 64 bit would work as it does when ported from 32 bit to 64 bit. I'm stressing this because I wrote the aplication on LV 32 bit (on win7 64 bit) at first place and it worked fine, then I ported the project to LV 64 bit (on win7 64bit) and it didn't work anymore as it did on LV 32 bit. That is very annoying and is the reason why I reported it as a bug to NI.

 

Dejan

0 Kudos
Message 3 of 4
(4,415 Views)

can any one tell why am not getting the right image when i am reading it from saved text file. please help me out..

VI is attached

0 Kudos
Message 4 of 4
(3,740 Views)