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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding center in black part of greyscale image

Hi all,

 

Basically what I want to do is find the center of a black part of a gray scale image. I'm having a bit of a problem using built-in LV functions, because the part of the image is somewhat spherical but not completely.

 

What I'm doing is imaging drops (I attached an example one to the post), and the drops show up as mostly black (except for the center) due to a bright blacklight. I am currently calculating the size of the drop by converting the image to an array of 1/0s where the 1s represent the region of the drop (and sometimes the edge of the image, depending on the exposure), I then scan each column of the array to calculate the diameter of the drop at that column by subtracting the first and last 1 that I find, then summing over the entirety of the drop and converting that into voxels then microliters. Phew.

 

So now, what I'm trying to do, is find the center of the drop in x and y. I was thinking I'd be able to use some sort of average of the first/last numbers of each column (and then of each row) but everything I tried didn't seem to make sense and I can't figure out if my method is bad, or my implementation in LV was bad. Any ideas on what I could do here? I attached the code I'm using currently to take the pictures and calculate the drop size, although it may be easier to just start from scratch using the attached image.

 

I appreciate any advice! Hopefully I explained that well enough, but I know it's a bit confusing.

 

Laura

0 Kudos
Message 1 of 3
(2,261 Views)

Hi Laura,

 

What Vision functions have you tried so far? Have you considered using something like the Particle Analysis VI? You can get information about the particle this way, including the X and Y center of mass.

0 Kudos
Message 2 of 3
(2,197 Views)

Hi (again) Burrito,

 

I started out trying to use the Vision functions, but since my image isn't necessarily a circle nor does it have any straight edges I was having a hard time trying to figure out the best way to use the functions. Someone else I discussed the code with though also recommended making more use of the vision functions if possible - I'll look more into the particle analysis VI. Thanks for the advice!

 

Laura

0 Kudos
Message 3 of 3
(2,156 Views)