10-24-2008 06:35 AM
Hi
I very much welcome your suggestions as I feel it should be easy yet can not seem to solve it. Thank you for your time!!!
10-24-2008 08:41 AM - edited 10-24-2008 08:50 AM
10-24-2008 09:46 AM
Thank you for your reply !
I have tried the function as you suggested but it does not seem to work as I work with PNG files rather then RGB.
I can open and work OK with the PNG files using the IMAQ image functions (Create, Read, Rotate) and I can display the image using a IMAQ Image Control.
Also I can open PNG files using the Picture functions (Read PNG , Flatten Pixmap) and display them as background to the graph.
What I want to achieve is a combination of both ie. Attch the ‘purple’ IMAQ image wire to the ‘blue’ Picture data wire of the PlotImages.Back.
Thanks again for your time and suggestions ! Would be great to get this solved before the weekend !
10-24-2008 11:29 AM
10-24-2008 11:42 AM - edited 10-24-2008 11:43 AM
10-29-2008 11:43 AM
Hi Randall
Apologies for replying somewhat late but I have been out of the office for a few days.
Your suggestions and code helped me greatly and led to solving my query so thank you for that.
There is one more thing (well many many more but I will place new posts for those however that you might be able to answer for me.
Following your suggestion to use the image to array function I searched through more examples and found the code that did exactly what I wanted to do. Please see attached.
In this code a For loop is used to add 65793 to the color table. It works very well but I do not know why it is used exactly. Can you exlplain? I also realize I never made it clear that I use grayscale PNG files rather then color images.
Thanks again for your excellent help, it is much appreciated.
10-30-2008 12:58 PM - edited 10-30-2008 01:03 PM
The FOR loop is creating a color table to translate your 8-bit data into color data. If you look at the array that is generated from the loop, the number 65793 is 0x010101 and it generates an array so the pixel values will translate as follows.
0 = 0x000000
1 = 0x010101
2 = 0x020202
3 = 0x030303, ...
This will give a color table of shades of gray (Red, Green, and Blue components have same value).
By the way, if you use the code I posted it will automatically convert your grayscale image to RGB keeping the appropriate grayscale values. In other words, it will read in your image and display it properly.