LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Draw Bounding box onto the detected cells

Solved!
Go to solution

Hello,

 

 

I working on project where I have to find the cells and draw the bounding box onto the detected cells .

 

For the same I made a Vi which can detect the cells, but in next step I do not know how to draw the bounding box onto the detected cells, while I have pixel values(React(Left,top,right,bottom) for each cells to create a bounding box.

 

I have attached the Vi better understanding.

 

I have tried function overlay and IMAQ Draw, but not getting the result.

Should I use for loop ?

 

0 Kudos
Message 1 of 12
(2,976 Views)

Let's assume you have the Bounding Rectangle for N particles, and you want a Bounding Rectangle of the smallest size that includes these N Rectangles.  Its Left Edge will be the minimum of the N Left Edges, its Right Edge will be the maximum of the N Right Edges, with similar considerations for Top and Bottom.  Problem solved!

 

Note that this solution assumes that the edges of the Rectangles are not rotated, i.e. are horizontal and vertical.

 

Bob Schor

0 Kudos
Message 2 of 12
(2,966 Views)

 Hi,

 

I wanted to make bounding box onto the detected cells I have attached image by which you get better idea.

 

In second attachment I have attached the image of detected cells after analysis has been done.

so System has detected two cells this time so now have to draw bounding box onto two cells. 

Download All
0 Kudos
Message 3 of 12
(2,955 Views)

Did I not understand what you want to do?  Did I not explain it clearly?  Here is your Bounding Box picture showing 6 cells and their Bounding Boxes.  I assumed you wanted a single Bounding Box (shown here as the Red surrounding Box) that bounded all of your cells.  It's left edge is clearly the left-most edge of all of the BBs, similarly with Right, Top, and Bottom edges.

Bounding Box.png

Did you want something else?

 

Bob Schor

0 Kudos
Message 4 of 12
(2,917 Views)

Hi,

 

Yes you did not understand the my point,

 

No I do not want single bounding box which bounds all of my detected cell like red one.

 

I need to create bounding box on each detected cell, but I do not know how to make bounding box on each detected cells?

So if you could help me for the same that it will be very helpful.

 

0 Kudos
Message 5 of 12
(2,898 Views)

How do you "detect cells"?  The image that you provided appears to be a binary image, either black or maximum intensity red (there may be a few points that are different, but that's how it appears).  How did you acquire these images?  Are they truly binary?  Was LabVIEW used to acquire them?  Did you do any image processing to determine that there are 2 (or 6, or however many) Cells?

 

Please post any/all the LabVIEW code you have used to get these images in this state.  Since Image Processing is one of the more challenging things to do in LabVIEW, could you please tell us something about your experience with LabVIEW, and also your experience with LabVIEW Image Acquisition and Processing.

 

Bob Schor

0 Kudos
Message 6 of 12
(2,887 Views)

Hi,

 

I made VI which detects the cells from the real image.

 

To detect the cells I use the same flow (Real image , Gray Scale, Threshold, Particle remove, Dilate, Fill Holes, Particle Analysis). 

Yes the image which I provided to you was binary, I got that image after doing image processing.

 

I have attached VI which I use to detect the cells.

 

but I need to find a way to make bounding box on detected cells.

0 Kudos
Message 7 of 12
(2,870 Views)
Solution
Accepted by topic author @mi

You are extremely close!  When you do the Particle Analysis, in addition to allowing you to get the Center of Mass in X and Y, it also gives you (at least in LabVIEW 2016) Bounding Rect Left, Bounding Rect Top, Bounding Rect Right, and Bounding Rect Bottom.  Use those to build an ROI (Region of Interest), plot the ROIs, and you have what you want.  Here's a (slightly cleaned up) Snippet, plus the VI itself:

Detection.png

One "trick" is that an IMAQ ROI is a funny gadget.  To plot two rectangular ROIs on an Image (as I do at the very end), the two ROIs need to be "combined" into an "ROI with two pieces", for which there is an IMAQ function that is easily overlooked ...

 

Bob Schor

0 Kudos
Message 8 of 12
(2,858 Views)

Hi,

 

Thank you very much for providing me a solution and it works as it should be.

 

but I need more help if you or someone can,

 

I wanted to detect the each cells and have to make bounding box onto them, but many times VI detecting the three or four cells as a one cell and make bounding on to them, while they are very close to each other.

 

So I wanted to make separate each cells and then I have to make bounding box onto them.

 

How can it possible to make them separate?  I tried separate function erosion but it not working properly.

 

I  have attached two images if you wanted to check by your self. 

0 Kudos
Message 9 of 12
(2,836 Views)

This is a difficult problem, particularly if you want the Computer to do all the work.  Have you considered (for these "difficult" cases) simply displaying the Images and manually creating circular ROIs to define the cells?  You could have a two-step process -- allow the automated algorithm to define ROIs on your Image, then present it to you and allow you to manually make changes, if required.  

 

This is a topic that is under active research.  I recommend that you do a Web Search for Petra Perner, who directs a group in Leipzig, Germany, working on these problems.  You might also look up "Advances in Mass Data Analysis of Images and Signals in Medicine", the proceedings of a 2007 Conference that has papers dealing with this issue.

 

Bob Schor

0 Kudos
Message 10 of 12
(2,833 Views)