Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ Write TIFF File and IMAQ ReadFile - Issues with color table

Hello:

I use IMAQ Write TIFF File to save a 2d array to TIFF. I use the following steps, 1) normalize the image array to U32, 2) IMAQ array to color image, 3) IMAQ write to TIFF.  I am using RGB (U32) type image as IMAQ create type. I take the color table from an intensity graph and convert it to the array of clusters that IMAQ Write TIFF File wants to see as its color table input.  In the simplest test case, though, I use a simple gray scale array for the intensity graph color table so that the array of clusters is 0 --> 255 for RGB entries.  I verified that the conversion to cluster color table format went fine.

I later use IMAQ ReadFile to read the TIFF image and I specify to load the color table (color table load input = true).  Again, I specify RGB (U32) image type.  The IMAQ ReadFile outputs an empty color table.  Has anyone else seen this?  What do you think might be going wrong?

Sincerely,

Don
Download All
0 Kudos
Message 1 of 3
(3,766 Views)
I followed this write strategy (which I now believe to be incorrect since an RGB type image contains the color information) by trying to write 8-bit (U8) and 16-bit (I16) TIFF files and applying the same grey color table.  I still come up with an incorrect TIFF image.   My question now becomes:  What is the strategy to use the IMAQ Write TIFF fx with a custom color table?

Thanks,

Don
0 Kudos
Message 2 of 3
(3,757 Views)
Here is the answer to my question at least for 8-bit data (U8):

1) Select U8 Image Type for 'IMAQ Create'
2) normalize the 2d array data to between 0 and 255
3) Feed into 'IMAQ ArraytoImage'
4) Feed Image out from 'IMAQ ArraytoImage' into 'IMAQ Write TIFF File' and also feed the custom color table in array of clusters format into 'IMAQ Write TIFF File'.
5) For reading the image, make sure to use U8 data type again for 'IMAQ Create', Use 'IMAQ ReadFile' to read the image and load the color table for this fx, then use 'IMAQ ImagetoArray' to output U8 array

The reason I was not able to get this working in my last post was I forgot to rescale the data to between 0 and 255.

I am sure this works similar for 16-bit data (I16) except the data has to be scaled to between -32768 and +32767.

Sincerely,

Don
0 Kudos
Message 3 of 3
(3,752 Views)