I'm trying to find the coordinates of the centroid of the projected image from the SURF example.
The example has an array of points like this : PointF[] pts = new PointF[] The result of these points are as follows as seen in debugger : X1,Y1 - Top Left X2,Y2 - Top Right X3,Y3 - Bottom Left X4,Y4 - Bottom Right
I want to extract the values as int or double so that I can calculate the centroid. How do I do this?
If i understand your question, you have an array of PointF, so you want to access to each coordinates:
IF your array contains 2 elements, you have pts[0] and pts[1], so you could access X and Y like that:
pts[0].X, pts[0].Y and so on...
Not sure I follow your question. PointF has a X and Y properties that are both float
are you asking how to access them in the array?
PointF[] pts = ...
pts[index].X; // this will get you the X value for the PointF at the given index
If you have a method the takes int
or double
that you want to pass these values to then a simple cast will get you what you need
double x = (double)pts[index].X;
If there's something else that you don't understand could you elaborate in your question?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.