c++ - Extract data from Point2f -
I am developing a code that needs to find a red slice. I get the function of the image to get the center of the image < Code> minEnclosingCircle .
The way the function gives me, vector format Thank you! - Update - I will post some code to try to do better what I want to do: So once I get the shape from my image, I apply the function from your comments Suppose I have found 20 circles and I know that Circle 15 is the largest. I want to know the position of the D X and Y Center [15], which is a point, but inside a vector. Without limit inquiry: with border check: Regarding the range of vector, if index is Note that the index starts with vector & lt; Point 2f> Center (contours.size ()); However, I need this data to determine the area of interest (ROI). Can I extract data from a point in any way, so that I can get two coordinates in X and Y in the integer?
vector & lt; Vector & lt; Point & gt; & Gt; Contours_poly (contours.size ()); Vector & lt; Point 2f & gt; Center (contours.size ()); Vector & lt; Float & gt; Radius (contours.size ()); For (Int i = 0; I & lt; contours.size (); i ++) {approximate polydee (mat (pattern [i]), contours_poly [i], 3, true); MinEnclosingCircle (Mat) contours_poly [i], center [i], radius [i]); }
minEnclosingCicrle to determine the center I am very new in OpenCV I think that it shows that the center of the circle is saved in this vector of point2f. The thing I want to talk to is to get to this point to get the position of my object to determine an ROI around the object.
float x = center [15] .x; Float y = center [15] .y;
float x = center.at (15) .x; Float y = center.at (15) .y;
& gt; = Center.size () , then you are out of range so you can check yourself:
int idx = 15; If (idx
0 , So here we are reaching the 16th point.
Comments
Post a Comment