From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

auto colour threshold

Solved!
Go to solution

For grayscale images (U8 type) I use the IMAQ AutoB Threshold.vi (Method=Clustering) to determine the optimal threshold of an image (ie. some threshold value between 0 to 255) which I then parse to the IMAQ Threshold.vi which then applies this threshold level to the image.

 

However I can't seem to find an equivalent AutoThreshold VI for colour (RGB type) images, which is currently forcing me to manually set the colour thresholds to the IMAQ Color Threshold.vi.

 

The only VI that comes close is the IMAQ ColorHistogram.vi and I was just wondering if there was something else I had missed?

 

What I'm trying to do is isolate a blue vertical bar in a colour ultrasound image (where most of the image is either black or white). So I set the Red/Green range low (Min=0/Max=100) and the Blue range high (Min=200/Max=255).  However I then got an image which had a purplish tinge to the background so the FIXED threshold ranges didn't isolate the blue vertical bar properly.

 

So I wanted some dynamic way of detecting the colours in the image and then set the thresholds appropriately so it would always isolate the vertical bar.

 

Chris

0 Kudos
Message 1 of 4
(3,574 Views)
Solution
Accepted by topic author ChrisReed

Hello

What I suggest is to extract the color planes of your RGB image. For example, extract the blue plane as it might be the one with the greatest contrast due to your blue line. Then use the IMAQ autoB threshold on the blue image (wich is actually in 8bit) and the threshold returned should be applied as the

blue threshold on your color image.

Color Threshold.png

Regards

NTA_LabView_certified_Developper.jpg
Message 2 of 4
(3,571 Views)

Thanks Toto, your idea worked perfectly.  If I knew how to give you Kudos I would.

 

Chris

0 Kudos
Message 3 of 4
(3,559 Views)

Oh right - you just click on the Kudos button - well der!!

0 Kudos
Message 4 of 4
(3,558 Views)