LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate and display pixels in image taken from triggered camera

Hi all,

 

I am trying to use LabVIEW to calculate the volume of a drop that I'm imaging. I've been able to do this successfully before when I was using a camera that I just "snapped," but now I am using a motion sensor to trigger the camera when the drop falls and now my code won't work - I'm assuming because due to the trigger, everything is within a loop? I'm not getting any output values for the volume, or any array even when I export the array to Excel. I attached the simple code I was using for the triggered camera and also the code where I added in the image analysis, although this is working to capture an image but not to calculate the volume.

 

I don't know if it's necessary that I explain what the image analysis part actually is but in case it helps, I first convert the image to an array, converted pixel values within a certain contrast threshold to 0/1s, then scan each line of the image to find the edge of the droplet and calculate the diameter of the drop at each given point. I use those diameters to calculate the entire volume of the drop in voxels, then use a ratio of voxels/volume to calculate the volume.

 

I appreciate any tips  you can give me! I assume it's a quick fix but I can't figure it out...

 

Laura

0 Kudos
Message 1 of 11
(2,919 Views)

Never mind! I figured it out - I had issues with switching between U8 and U32.

0 Kudos
Message 2 of 11
(2,914 Views)

Alright, I have to revive my thread again - so I've updated the code a lot from where it was before, but I'm still having some sort of issue.

 

Everything runs now, but the volume that it outputs is always off from what it actually is (the volume should be ~20uL, but I usually get around 3-5uL and sometimes as low as .1uL) so I wanted to check to see if anyone saw any errors with the way I'm analyzing the image, or if there's a better way to do it. I believe the error might be with the part in the For Loop, where I'm analyzing each column of pixels, finding the first and last index where there is a 1 (which represents the dark part of the image where a drop is) and then calculating the volume from that.

 

I could be explaining this horribly so if you need clarification on anything please ask! I appreciate any input!

 

Laura

 

 

0 Kudos
Message 3 of 11
(2,890 Views)

Hi Laura,

 

Would it be possible to post a sample image that could be used with your VI?

 

Also, you said in your first post that you were able to accomplish this task before. Have you changed the actual algorithm you are using at all since then?

0 Kudos
Message 4 of 11
(2,878 Views)

Hi Burrito,

 

I attached a (bad) image - usually the drop fits within the entire frame, but you can see an idea of the contrast that we're looking at.

 

Before we were using a non-triggered USB camera, and I was able to easily analyze the drops although I wasn't ever really sure if the actual volumes were the right numbers. Now we have a method of checking the drop volumes manually I'm realizing the drop volume outputs from Labview are off, which makes me wonder if my code has always been off and I just wasn't checking it properly.

 

Thanks for your response! Hopefully the image helps make it more clear what I'm trying to do.

 

Laura

0 Kudos
Message 5 of 11
(2,851 Views)

Hi Laura,

 

I took a quick look at your program using your sample image; how did you choose the value of 85 to compare your image's pixels to with the Less or Equal Function? It seems that all the pixels in the image were at intensities of about 75 or below, which was causing all of the volume calculations to be 0.

0 Kudos
Message 6 of 11
(2,837 Views)

You're right, in that image the exposure was too low so most of the image was gray. I messed around with that threshold value after changing our backlight and the exposure value; I attached an image where the value of 85 might make more sense.

0 Kudos
Message 7 of 11
(2,834 Views)

Hi Laura,

 

After checking the program with the new sample image, I'm also getting a volume of about .2 uL. The algorithm appears to be finding the edges of the drop alright, so I'm thinking that the error is somewhere in the implementation of the calculations and unit conversions. It's hard to check this without seeing the equations you're trying to implement, however.

 

Also, it appears that you are calculating a "contrast value" that you are never using in any calculations. What is the purpose of this value?

0 Kudos
Message 8 of 11
(2,818 Views)

Right, that's what I'm thinking too - I feel like the error must be within that loop in the middle somehow.

 

The equations I use are essentially to approximate each row of pixels as a cylinder. So I first find the cross-sectional area of the drop at that row of pixels (using pi/4 * d^2) and then multiplying it by 1 pixel (the height of that row) to get the volume of that cylinder, then I add over the entire length of the drop to get a total volume of the drop that's basically a ton of cylinders added together. Then I convert using the fact that for our camera 4.65 microns = 1 pixel.

 

I had the contrast value calculated when I was using images with bad contrast, like the first drop image that I posted, but then when we started getting better contrast images with a different backlight, I found that using 85 every time was sufficient.

 

Thank you again for helping me through this... I really appreciate it!

0 Kudos
Message 9 of 11
(2,809 Views)

A good troubleshooting step could be to check the equations manually. If you know the actual volume of one of the drops, you should be able to approximate some cylinders using your equations and arrive in the same ballpark. If you get an answer that is significantly off, then you'll have a clearer sign that something is amiss with the algorithm itself.

0 Kudos
Message 10 of 11
(2,788 Views)