LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measure colour threshold in video

Hi everyone. 

I need to write a program to analyse and measure a colour threshold in video data.  Basically it will be a static scene with red lasers.  As things pass by these lasers the red will disappear and will equate to a flow rate.  I want to measure the red pixel count from a histogram to quantify a flow rate over 30 second intervals.     

 

My labiew experience has been with hardware data acquisition not video, so keen for any advise on which way to attack this.  

 

1. Acquire video

2. Extract red count from each video frame and store in a temporary register.

3. After 30sec, sumate red count of all frames and display to the front panel. This can be converted and calibrated to a known and meaningful representation. 

 

Thanks for any help getting me started in the right direction.  I don't have the vision module yet although I assume I'll need it.  

 

Wes

0 Kudos
Message 1 of 7
(3,250 Views)

Not difficult at all. The tricky part is to acquire the image. With the Vision toolkit, it should not be a problem. You then obtain the image as a RGB array. A RGB array is an array of U32 where 1 byte is for red, 1 byte is for green, and 1 byte is for blue. The 4th byte is not used. Labview has tools to convert a U32 or an array of U32 into red, green, and blue bytes. For each of your images, you can extract the red bytes and accumulate over a U32 for example.

Marc Dubois
0 Kudos
Message 2 of 7
(3,225 Views)

Yeah that's basically it.  Some image grabbing hardware has LabVIEW drivers so you don't need to buy the vision toolkit, when all you really need is to take an image.

 

Also there is some older drivers for USB webcams that work without needing to purchase the vision toolkit.  Don't get me wrong the toolkit is great and worth it if you use the features it has.  But I can't justify the price if all you need to do is take an image.

 

http://www.ni.com/example/30030/en/

0 Kudos
Message 3 of 7
(3,201 Views)

Thanks guys,

 

Makes perfect sense.  Just trying to get my head around where to start, but I guess I'll try and get a photo image into labview and go from there.  Might need to get the vision module I guess.  I need to do some manipulation of colour thresholds to extract all of the red colours, which might not all be in the Red array, not sure. 

 

Cheers,
Wes

0 Kudos
Message 4 of 7
(3,190 Views)

 You can easily loads an image from a file, separates the colors, and recreates an image for each color using the tools available in Labview without the Vision toolkit. Below is an example of how to do it.

 

 

pict.png

 

 

 

 

Marc Dubois
0 Kudos
Message 5 of 7
(3,166 Views)

That's great.  Are you able to share that example code with me as a vi?  

Cheers,
Wes

0 Kudos
Message 6 of 7
(3,141 Views)

Sure, here it is saved as 2010 version and as a snippet as well. As a side note, I initially wanted to give it as a snippet but I realized that the Code Capture Tool cannot be installed on Labview 2014. I am surprised that it is not mentioned (as far as I can tell) in this forum. I found the solution on JKI website. It's a bug in the version of VIPM provided with Labview 2014. A new fixed version of VIPM can be downloaded from JKI website.

 

pict to RGB picts_BD.png

Marc Dubois
0 Kudos
Message 7 of 7
(3,133 Views)