05-21-2011 06:28 AM
Hello everyone,
I have never done this basically but while having a coffee I thought this would help me out a lot. I have an image file from a certain experiment and have to identify different regions of the image based on its color (brown, black, silver etc). I have never used VisionAssistant but am wondering if there is a possibility of making a histrogram of the different colors present in the image file? I have seen a matlab code for doing this. And wondering if anyone has tried this with labview.
regards,
05-21-2011 01:22 PM
There may be fancier ways to do this, but you read the file in as an image and then use "unflatten pixmap.vi" to get a 2D array of all the image pixels. For example, indexing an element out of this array and feeding it into a color box indicate will show you the colour of the pixel.
You can then sort through this array counting all elements of a particular colour or within a particular range of colours, giving you all the info you need for your histogram. It will also allow you to compare different areas of the image by comparing different 'areas' of the 2D array.
Ian
05-21-2011 03:15 PM
example attached - can't help but wonder if there are some unnecessary steps in converting to a 1D array for the histogram vi. Anyone?
05-21-2011 03:27 PM
Is the image paletted or RGB?
If it is RGB, a histogram does no make much sense unless you have a way to logically group very similar colors.
If it is paletted, initialize an I32 array with the size of the colormap and increment elements according to the color index. (shift register, stacked loops, in place element structure & some trimmings)