LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Representing Differences in Pixel Intensity as Different Colors

Solved!
Go to solution

Hello, 

I have been researching how to represent differences in pixel intensity as different colors, but I have been unable to find anyone who has done this. I would corrrelate the pixel intensity to thickness of a film of oil; the thicker the filem the more intense the pixels are. Ideally, I would take a grayscale image convert it into an array, so I have the pixel intensities. Then, I would make a range of intensity that each color corresponds to and convert back to an image, such as blue corresponds to pixels of intensity 0-3 and purple corresponds to pixels of intensity 4-5. I would display the image and visualy show the range of numbers I used for each color. I am unsure how to implement this. Can this be accomplished by a lookup table? I have attached my current VI. I failed to realize that converting an image to RGB doesnt mean you get colors on your previously gray image haha!

Thanks,

Ryan

0 Kudos
Message 1 of 11
(3,111 Views)

I also attached the image I am using. 

Thanks

0 Kudos
Message 2 of 11
(3,107 Views)

You can use elements from the Picture Function Palette, Picture to Pixmap VI returns a cluster which contains the RGB color array of the picture. Once you have this array you can map it using conditionals or case structures. Then use an intensity Graph or Chart to plot the new color array.

0 Kudos
Message 3 of 11
(3,044 Views)

I am unsure what you are refering to when you say "you can map it using conditionals or case structures. Then use an intensity Graph or Chart to plot the new color array." I attempted to use case structures to replace the pixel intensities with color values. I have attached what I have done, which is not working. It also seems like a terrible way to do this, but I do not know another way. I have attached my VI. Any help is appreciated!

0 Kudos
Message 4 of 11
(3,018 Views)

I need to be able to pass the edited array to the next case structure within the loops.

0 Kudos
Message 5 of 11
(3,017 Views)

I have been working on my VI and cleaned up my case structures, but its is still not working. I am trying to replace pixel instensities with 32 bit color values in the array, but I just get back the same array. I have attached my current VI.

0 Kudos
Message 6 of 11
(3,013 Views)

Found my previous issue, but now the pixels are only being edited on the righmost side of the image. I am not sure why. I ahve attached my VI and the image im editing.

Download All
0 Kudos
Message 7 of 11
(3,008 Views)

See this thread where we were talking about a related topic last week to generate the color ramp.

 

Then some creative use of "Threshold 1-d array followed by a  interpolate array can give you an index into your color ramp.

 

Have fun!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 11
(3,006 Views)

I am not sure how the thread you pointed to will help me with the current issue I am having with only the pixels on the right side of the image being changed. Could you take a look at my most recent VI and let me know if you see an issue?

Thanks

0 Kudos
Message 9 of 11
(3,000 Views)

That thread would help with the mapping.

 

I do not have LV 2017  so post some images and maybe I can see something.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 11
(2,994 Views)