Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Unwrap Example - not working properly with U16 image type?

Hi Folks - Trying to get the IMAQ unwrap fx to work with U16 data type.  Not sure why the unwrapped image is displaying as all zeroes.  Green annulus shows that area surrounded are gray values > 0.  I tested the 16-bit mapping option to no avail. Full dynamic mapping is used for both 16-bit Vision containers.

 

This is a critical problem that I need some help with.

 

Can someone take a look and let me know how to fix this.

 

I would have to file transfer or email the example image as it is about 10 mbyte (and is it possible that this is the problem - the IMAQ Unwrap has a size limitation?) and I am not able to post it here due to the 5 mbyte upload limitation.

 

Thanks,

 

Don

0 Kudos
Message 1 of 8
(4,222 Views)

IMAQUnwrap problem.PNG

Here is a front panel showing the unwrapped image with all 0 values.  The annulus is set to a width of 30 pixels.

 

Don

0 Kudos
Message 2 of 8
(4,220 Views)

IMAQ has had historical problems with fully supporting 16-bit images. Typically, they will suggest you convert the image to 8-bit. The 16-bit to 8-bit image vi is within the forums.

 

For me this has been a huge irratitation, but the latest release of Vision 2010 does have better support for 16-bit data.

 

Not what you wanted to hear....

 

Regards

Jack Hamilton

0 Kudos
Message 3 of 8
(4,212 Views)

Hi Jack - This is not the answer I was hoping for Smiley Happy.  The unwrap function is supposed to work with a number of different image types including 16-bit.

 

I also looked at the unwrap example that comes with Vision which opens an 8-bit jpg.  I substituted U16 image type in the IMAQ Create fxs in that example and it still worked fine,  Which is I thought 16-bit itself was not the problem, but maybe the size of the file was (the U16 binary file I have is 10 mbyte - pretty large for one image file.).  Only NI can look at this since the unwrap fx consists of a CIN.  By the way, I am using 64-bit LabVIEW and Vision 2010.

 

If I do not hear from NI engineer on this, I will contact support directly.  I have to have this fixed.  I would like to send them the binary file so they can investigate this further.

 

Hope you are doing well.

 

Sincerely,

 

Don

0 Kudos
Message 4 of 8
(4,208 Views)

Folks - I have uploaded the U16 binary file to NI ftp site  (ftp://ftp.ni.com/)   /incoming folder.  The file name is "Martin PMC tube sn#1008-50um000087.rec".

 

You can also try with a 16-bit png, as I have uploaded a file of the same name (Martin PMC tube sn#1008-50um000087.png) that I wrote to png format using the IMAQ Write File function.  You would have to slightly change the code slightly to use the IMAQ Read File function instead of my binary file read.   

 

I also get a blank Unwrapped image with the 16-bit png.

 

I need the 16-bit resolution for my project.

 

Sincerely,

 

Don

0 Kudos
Message 5 of 8
(4,202 Views)

Hi, Don

 

Here is clear bug in IMAQ UnWrap.


--------------------------------------------------------------------------------
DonRoth wrote:

The unwrap function is supposed to work with a number of different image types including 16-bit.

 --------------------------------------------------------------------------------

 

This problem is reproducible. IMAQ UnWrap work incorrectly under following conditions: U16 images AND Bi-Linear Interpolation is used AND pixels intensities are over 32767 grays.

 

--------------------------------------------------------------------------------
DonRoth wrote:
I also looked at the unwrap example that comes with Vision which opens an 8-bit jpg.  I substituted U16 image type in the IMAQ Create fxs in that example and it still worked fine,  Which is I thought 16-bit itself was not the problem, but maybe the size of the file was
--------------------------------------------------------------------------------

Yes, it worked fine, because grays are still in range 0...255. Try to stretch grays to full U16 range (for example, multiply image by 256, then you will see troubles in original NI example as well.


--------------------------------------------------------------------------------

DonRoth wrote:

Only NI can look at this since the unwrap fx consists of a CIN.

--------------------------------------------------------------------------------

By the way - Its not a CIN, its a CLF (Call Library Function)


What you can do is following (except waiting bug fix from NI):

 

- Turn off Bi-Linear Interpolation (change it to Zero-Order) if this acceptable. Zero Order works fine for U16 full range.

- If you need Bi-Linear Interpolation and U16 type, then simply divide your image by two (one bit will be lost, of course).

- If you still need full range, then you will need to convert image to I16, perform Unwrap, then convert the image back to U16.

- Alternatively - you convert image to SGL, perform Unwrap, then convert the image back to U16.

 

With best regards,

Andrey.

 

Message 6 of 8
(4,182 Views)

Hi Andrey -

 

Thanks for taking a detailed look at this.  Great post.

 

First - NI is now aware of the bug and looking into it.

 

Second - In the back of my mind, I thought about playing with the interpolation option but from a logic standpoint, I was not sure why that would make any difference.  I also played around with I16 and made the requisite conversion from SGL to I16 but for some reason could not get even the original image to show up with the proper set of gray values.  But I did get an image to show up in the unwrap vision container (just not the right gray shades).  So I gave up on that. 

 

You present some possible future options.  Let's see if NI can just fix this and get it working properly with U16 (since even the help on the function says that it is compatible with U16).

 

help-on-unwrap.PNG

 

Thanks,

 

Don

0 Kudos
Message 7 of 8
(4,173 Views)

I verified that U16 unwrap works properly with 'zero-order' selected as the interpolation option.

 

So this is a partial solution at least and greatly helps me.

 

Thanks again Andrey!

 

Don

0 Kudos
Message 8 of 8
(4,170 Views)