LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI Vision: Color Spectrum

Hallo,

 

I have a more or less tricky question to the community. As a part of my PHD-Thesis, I have to measure the residence time of particles in a machine . I want to use UV-fluorescent plastic granulate as tracer. In a first step I want to do a simple feasibility study. I have 2 Webcams (using IMAQdx) and a conveyor belt, measuring the intensity of fluorescation under black-light and calculating the time, dedicated by the conveyor, between the "peaks". I want to use the "Color Spectrum" VI to get a value for the blue intensity of the picture.

 

So I want to ask 2 questions to experts:

 

1.) If I use the Color Spectrum VI I get an array as result BUT which array value stands for blue? (The Help gives me no usable answer)

2.)Has anyone a better idea instead of using the Color Spectrum VI?

 

Thank you for your efforts!

 

Best regards,

 

Paul

 

 

0 Kudos
Message 1 of 10
(5,399 Views)

Hallo Paul,

can you post of screeshot of the palette with the "Color spectrum" VI?

I don´t find any VI with this name..

Best regards

 

Andrea P. 

0 Kudos
Message 2 of 10
(5,378 Views)

Hallo Andreas,

 

it is very embarrassing for me but I was wrong with the VI Name. The name of the VI is "ColorLearn", in the "Color Processing" palette of the VISION-Module. I was a little bit dizzy when I wrote the Post, sorry!

 

Best regrades,

 

Paul

 

0 Kudos
Message 3 of 10
(5,370 Views)

The best way here is to analyse shipped example: 

 

https://decibel.ni.com/content/docs/DOC-2127

 

This example allows you to draw an ROI around a part of the image that contains the color you are interested in, then it learns what color that is. The ColorLearn vi produces a color spectrum datatype that can be fed into the ColorMatch vi used in the ColorMatching example. The ColorMatch VI can be used to determine where in an ROI a certain color exists. This should enable you to highlight a specific color that a user can quickly and easily change. 

 

Best regards

 

Andrea P.

0 Kudos
Message 4 of 10
(5,359 Views)

Hallo Andreas,

 

thank you for the link to this nice example. Just to recapitulate the example, the ColorSpectrum VI gives me a Array of 16 values according to the 16 basic colors (4bit?)? The array represents the ROI I choose. Al values in this array are normalized to 1, so adding up every 16 values gives 1?

 

Best regards,

 

Paul

0 Kudos
Message 5 of 10
(5,351 Views)

This is somewhat related to the original question.

 

I need to calculate the area of certain colors in an image.

The colors are not pure RGB, and are very close in the HSL and RGB color spaces.

I have struggled to find good ways of detecting them, so that I could calculate the areas, but yet I have not found a method that can match the colors as well as the build in LV_ColorMatch() and LV_ColorLearn combination.

 

my problem is that I cannot do it fast enough.

 

The colors represent different layers of a material, that is randomnly damaged, as a result the areas that I am looking for occurs unstructured. The camera resolution is matched to the task, so that 1 pixel after bayer bilinnear colour estimation represents the area resolution the customer is looking for.

 

The images are precaptured and the ROI is found by the capture system, that produces the images for this vi.

The input images are 3000w by 300w [px]

when I attempt to do it like this double for loop, I have to iterate 300x3000 times ~900'000 times - and that takes about a minute.

However I need to do this in about 3 seconds.

 

The image below contains a screenshot of a simplified version of my software, that illustrates the algorithm that actually works well enough to provide a decent count of target colours.

 

(I know the mm/px ratio in both axis, so I can multiply the count with that and get the area)

 

 

forNIforum.png

 

This is very frustrating as the build in histogram / historgraph uses a few milliseconds, and even though they only look at 1 colour space, I guess they must access the image data in another way than the double for loop pattern.

Engineer, M.Sc. Autonomous Systems, Automation and Control of non-linear systems
Project Engineer @ R&D A/S
www.rdas.dk
0 Kudos
Message 6 of 10
(5,283 Views)

Zcuba, do not hijack other threads !!

 

As a rule of thumb, if you are looking for a region (different layers of material) first figure out the region !

 

You are using functions, that will give you the result, but as you figured out, it takes loong.

 

Your source code can be replaced by faster alternative using IMAQ color treshold. You should get your 3 seconds.

If you dont fancy HSL, just use the RGB model. For images of your size, the treshold should run in about 50ms (guess).
 

 

Try something like this :

 

Bez názvu.png

Message 7 of 10
(5,274 Views)

Hi Bublina

 

It was not intended as a Hi-Jack 

The question I tried to formulate, is so closely related, (on how to use the color learn / color match efficiently) that I thought creating a new thread would merely make someone link to this one. Smiley Embarassed

 

- I have no problem with using the Hue-Sat space, in fact I already tried using the IMAQ color treshold on RGB space with terrible results, and have tried without achieving a robust result with the HSL space.

The reason for abandoning the strategy (probably to fast) was due to the problems I faced with manually determining the optimal color spectrums for each layer. Smiley Wink

I am basicly looking for 3 shades of pink, and one gray layer that have similar intensities as one of the pink shades..

 

I will re-visit the idea after you'r comment, and use a little more time on calibrating color spectrums, but have little confidence that I can eperate the layers robustly using only 3 color space threshold attributes.

 

It seems that in tests the combination of using colorLearn / colorMatch can seperate the layers robustly.

So I am very interested in the original question, and may have formulated my own in a slightly wrong way. Smiley Embarassed

 

What I tried to ask was that I would very much be able to use the "color spectrum" from colorLearn to do a histogram (like you'r example shows for the HSL space) but I want to do the histogram on the entire parameter set in color spectrum, as this seems to seperate colors better than I could do manually.

Hence I also, like the original questioneer, have interest in knowing what the parameters in the Color Spectrum Array, are indicating.

I did not get much knowledge from running the example linked to...

 

thank you for the help though Smiley Happy

Engineer, M.Sc. Autonomous Systems, Automation and Control of non-linear systems
Project Engineer @ R&D A/S
www.rdas.dk
0 Kudos
Message 8 of 10
(5,261 Views)

Zcuba,

 

1. Find the region

2. Further processing

3. Further processing

 

I suggest your regions are somehow uniform, once you match some location, you can do some fine tune selection using whatever algorithm you develop on much smaller regions (those roughly filtered) so it will run faster.

 

You mentioned, that you are looking for 4 regions total with similar color (I do not follow the grey similar to pink),

so use the treshold VI to cutoff a big heap of noise and run your algorithm through the remains.

 

If you have trouble with similar colour identification, I have best experience with NN color clasifier, the clasify VI eats ROI as input so convert

the roughly filtered binary image into ROI(s) and clasify them. Thats the way I would try first.

 

p.s. There is a difference between Hi Jack and hijack, look at this youtube video for clarification.

0 Kudos
Message 9 of 10
(5,247 Views)

Admitted, I have not tried the NN Color classifier.

 

The erosion occurs in a somewhat randomized fashion, and have similar behaviour to the original questions description.

While the material coating layers, are certainly uniform in color space, the areas exposed are not a cohsing area.

The erosion depth map would look like many small holes, that are seldom connected to the same layer, and if they are, the resulting patch of exposed layer is seldom more than a 5-10 pixels wide.

 

I do however have a calibration image for each layer, allowing me to extract the expected color information prior to analysis. (actually you can see that pattern in the VI screenshot i posted) 

 

I will now try to follow the procedure mentioned, using NN Color classifier.

Should I run into trouble that i cannot resolve, I would agree with your previous comment about diverting from topic, and will start a new thread.

 

ps. It seems that the semantics of the "-" sign are different in Danish and English. Nice youtube Clip..

Engineer, M.Sc. Autonomous Systems, Automation and Control of non-linear systems
Project Engineer @ R&D A/S
www.rdas.dk
0 Kudos
Message 10 of 10
(5,236 Views)