Machine Vision

Showing results for 
Search instead for 
Did you mean: 

move center of ROI to centroid


as mentioned in the title, how do I move the center of ROI (rectangle) to the centroid location found within the ROI?

thx again
0 Kudos
Message 1 of 7
I'm still very new to Machine Vision myself, so take this with a grain of salt. I think that if you have found the center of the centroid you can define the rectange that you would like (based on the center point +/- where the edge should be). Then use the IMAQ Convert Rectangle to to create an ROI at the desired location.

Is this what you are asking for?

Bob Young
0 Kudos
Message 2 of 7
Hi Bob Young,

thx for your help.

I have created a ROI initially and I will find the centroid within the rectangle. Then I want to move the center of rectangle to the centroid inside the ROI. I wish to make translation instead of erasing the ROI and create a new one in the next video frame. Do you have any idea?

thx for your consideration again.

0 Kudos
Message 3 of 7

Unfortunately, there is no way to move the ROI without redrawing it between frames. The previous suggestion involving the use of IMAQ Convert Rectangle to ROI is the best option for you. The top, left, width, and height parameters for the rectangle can be determined based on relative positions with respect to the center of the rectangle.

Scott R.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7

Actually I'm currently trying to use Imaq TransformROI to move the ROI. I'm doubting if it is working. I will let u know if it works well..Otherwise I will erase and redraw as suggested before.

Really appreciate..

0 Kudos
Message 5 of 7
hi, im bharath..i have a rectangular image with a black circle in a white to obtain the centroid of the black figure alone..i tried image maskin but it is not workin out..pls pls help..
0 Kudos
Message 6 of 7
Try the attached.  You can change the parameters of the ROI using the ROI property.  This is in LV8.5

Message Edited by rpursley8 on 06-03-2008 09:32 AM
Randall Pursley
Message 7 of 7