LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Thresholds With Vision

Hello Community,

 

I'm using Labview Vision to analyze data collected from my microscope based instrument. The image I'm trying to analyse

is as below. I would like to average all of the red areas, representing a different morphology in my thin films. The image is floating 

so I was hoping to simply use thresholding to select the red regions and then use that image to extract only values from red regions in the float image. However, when i plug this image into the Image threshold and output it to a binary (I16) I an error due to the image type even though threshold is meant to work with float images. The output image is defined as I16.

 

So i cast the float image into I16 and now i simply get a get a blue image with only 1 value.

 

LabLoko_0-1658371121586.png 

LabLoko_1-1658371606363.png

 

The LV code is very simple. Really just a test. I attach a snippet here as well.

 

LabLoko_2-1658371656791.png

 

Any ideas on why this isnt working. I guess my casting isn't working.

 

Cheers

 

Jamie

0 Kudos
Message 1 of 4
(1,680 Views)

Hi LabLoko,

 

In the help of "IMAQ AutoBThreshold 2.vi", it says: "supported types: U8, U16 and I16".

So you need to convert your float image into an integer image (like I16).

 

To do that, a simple cast is not sufficient because your float values are surely in the range [0; 1], so they are all rounded to the same integer value.

 

What I would do :

 - Extract the float values as a 2D array with "IMAQ ImageToArray.vi";

 - Apply an ax+b so that the values are rescaled from range [0; 1] to the range of the integer type (like [-2^15; 2^15-1] for I16);

 - Cast the 2D array to the integer type;

 - Write the 2D array back to an integer image with "IMAQ ArrayToImage.vi";

 - Then you can apply your threshold function.

 

Find attached a conversion VI for that purpose.

Message 2 of 4
(1,636 Views)

@Jamie-S-Laird wrote:

Any ideas on why this isnt working. I guess my casting isn't working.

 


I think so, too. Maybe you need another  IMAQ Autthresholding function

 

 

is the value range of the float mage in [0;1]?

If yes, I'd guess you need to transform the float image to Color image in the value range [000000;FFFFFF] and then do global color thresholding

 

I can't test this with a vision licence right now, but here is my non-imaq draft:

 

1# make a screenshoot, crop and save as 24 bit png (you will probably work directly one the float 2d array..)

2# then extract only those pixels with R bigger than G and B

 

 

Spoiler
falschfarben-float.png

 

 

 

 

0 Kudos
Message 3 of 4
(1,630 Views)

On the front panel, right click the Image indicator, on the popup menu, select a color palette matches 16 bit image.

 

George Zou
Message 4 of 4
(1,616 Views)