LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Size Expansion of ROI / Rectangle

Solved!
Go to solution

Hello,

 

I am stuck with one simple thing help me out with that please.

 

Actually, I am capturing the beam image. On that image I detect the particle and I have all the particle parameters (left, right, top, bottom, height, width of the bounding box). I want to expand the size of bounding box/ rectangle/ ROI. 

 

How can I impalement this logic?

 

Any suggestions are helpful.

 

Thanks

 

0 Kudos
Message 1 of 6
(2,686 Views)

We need more information:

 

1. Are you using an NI product such as the Vision toolkit for this, or a 3rd party library?  Or is it all your own?

2. Where exactly is the problem?  What is stopping you from expanding the box?  What have you tried?

3. Can you post the code you're trying to use showing us what you've done so far?

0 Kudos
Message 2 of 6
(2,682 Views)

Hello,

 

1. I am using NI Vision tool kit.

2. Exactly problem is I couldn't figure out the logic. if I want to expand my search area. Need a help to figure out the logic> 

3. Here, I have attach the picture of my code and the image which i am using. 

 

Thanks,

 

 

Download All
0 Kudos
Message 3 of 6
(2,680 Views)

Sorry, I don't look at pictures of code, it's just too frustrating.  You do realize how ROIs work, don't you?  What shape is your ROI?  If it's a simple shape (rectangle, circle), expanding it is just simple math.

 

Bob Schor

0 Kudos
Message 4 of 6
(2,646 Views)

Hello,

 

That's Fine. 

 

I know how ROI is working. but the problem is I couldn't think about the simple math which help me to expand the ROI. 

ROI shape is rectangle. 

 

if I want to expand my ROI by 3 times then what logic I have to use?

ROI size- 

Left=2132

TOP=2128

Right=2169

Bottom=2166

Width= 24

Height=26

* all the values are in pixels. 

 

Please suggest some logic it would be really helpful.

 

Thanks.

0 Kudos
Message 5 of 6
(2,635 Views)
Solution
Accepted by topic author sspp07

Given L, R, T, B, you can locate the center easily:  (L+R)/2, (T+B)/2, or the mean between Left and Right, Top and Bottom.  You can get the Width and Height also easily: W = R-L, H = T-B.

 

Now, you want the Center to stay the same, but the Width and Height to triple.  Take pencil and paper, draw a picture, label L, R, T, B, W, and H, then work out the (very simple) equations to get L', R', T', and B' for the rectangle with the same center and triple the dimensions (in terms of L, R, T, and B).  Now code it in LabVIEW.  Then test it and confirm that it works.

 

If it does not, post your code (the VI, not a picture) here and we'll find the mistake.  But you must try it first!

 

Bob Schor

0 Kudos
Message 6 of 6
(2,632 Views)