Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Draw circles based on output from Shape Detection VI

I'm making a program that detect circles in an image and returns some statistics about the detected circles. Is there any way to somehow display the circles detected by the VI (Shape Detection) and display these on an image? I'm thinking something in the lines of this:

 

i) output the circles data (position coordinates and radii) to the Draw Circle VI

ii) convert picture data from Draw Circle to pixels

iii) create an array of pixels data

iv) convert array to image

v) display image

 

I'm clueless as to how to undertake this though. Any help is greatly appreciated.

0 Kudos
Message 1 of 18
(6,903 Views)

You can use IMAQ Draw to draw an oval (The coordinates you enter should be the bounding box of the circle). Note that the result of this function is destructive (i.e. modifies the underlying pixels of the image.

You can also use IMAQ Overlay Oval. The advantage of using this function is that it just overlays your circle on the image, but the underlying pixels are not modified and therefore, you can still apply other image processing functions on the image.

 

Christophe

0 Kudos
Message 2 of 18
(6,892 Views)

The thing is that the Detect Circles VI only outputs the circle center coordinates of the detected circles along with radius, whereas the IMAQ Draw requires bounding rectangle coordinates. I was thinking something in the lines of using the Draw Circle by Radius VI which only depends on center coordinates and radius to draw the circle, seems a lot easier..

0 Kudos
Message 3 of 18
(6,891 Views)

Dear Ahsin,

 

Now i have the same problem that you have. Did you solve it ?? if you did, could you please provide me a small Vi that illustartes the solution.

 

thanks,

 

carlos

0 Kudos
Message 4 of 18
(6,734 Views)
Hi carlos,

The end result proved quite successful, I must say. The company I was doing this thesis for (it was my final year project) was more than satisfied. I don't have access to the files atm, but will post it as soon as I do.

May I ask the real life application if your program?

Regards,

Ahsin
0 Kudos
Message 5 of 18
(6,726 Views)
I am doing my Phd in biophysics. My idea is to track beads that are into cells. As long the beads are fluorescent the signal tO noise ratio is pretty good. And i would like tO track those particle at the same time i am doing my experiment and not afterwards that is what normally people do. Looking forward to see the file
0 Kudos
Message 6 of 18
(6,723 Views)

Sounds interesting. I am assuming that these beads are circle-shaped?

 

The program is written in Norwegian, but it should be quite intuitive though.

 

The pictures illustrates the function of the program. It analyzes pictures of microscopic balls and returns a picture showing the detected circles/balls with their respective index and size in addition to the details of the picture as a whole. The program also generates two spreadsheet files, raw data and summary.

 SNAP-135252-0138.jpgSNAP-135252-0138.jpg_analysert.jpg

 

 

 

 

0 Kudos
Message 7 of 18
(6,721 Views)

Hello,

 

Does anyone knows the workaround of this program? I'm still trying to figure out how did Ahsin managed to draw circles based on the data provided by Shape Detection VI. Any help is welcomed

0 Kudos
Message 8 of 18
(6,387 Views)

Hello Cheatpeak,

 

It has been a while since I worked with the program now, but I will try to explain the process as far as my memory serves me.

 

i) Image manipulation

 

First you'll have to manipulate the image so that the computer is able to analyze it. This means that you will have to convert it to a binary image. If your image is RGB, you must first convert it to a greyscale image by removing one of the three color planes (I removed the green one). Then, by means of setting a gray-level treshold, the image is converted to a binary one.

 

ii) Image analysis

 

If you at this point have adjoining or "connecting" circles, they must be separated before their size can be analyzed. Else the computer will detect such circles as one continous object. This is achieved with a technique called watershed segmentation.

 

Given that your circles are now separated, they are ready for analysis. I personally found the Shape Detection and Circle Detection VIs to be far too inaccurate. Therefore I employed the Particle Detecton VI to find the circles.

 

iii) Image data overlay

 

To produce the results visually, I used image buffers to store the different images during the process, and in the end I combined and merged them into one single image. All of the images must me converted to grayscale images as the original image is in this format.

 

This is what I can remember from the top of my head. Please let me know if there's unclarity in the process (which I'm sure is due to my poor explanation).

 

Regards,


Ahsin

 

0 Kudos
Message 9 of 18
(6,384 Views)

Hello Ahsin,

 

Thank you for your quick reply. So far my program is able to threshold into binary image so i guess image manipulation is fine. My question are:

 

1. For image analysis, between watershed segmentation and normal morphologies such as erosion/closing, which one is better?

2. For image data overlay, which subVI did you use for image buffering? Does it need to be run multiple times(in a loop)?

0 Kudos
Message 10 of 18
(6,379 Views)