OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 01 Oct 2015 05:12:02 -0500How to separate the point2f to other variable?http://answers.opencv.org/question/71901/how-to-separate-the-point2f-to-other-variable/ Hello,
I had obtained the centroid coordinate in terms of float and array, Point2f a = mc[0]; Point2f b = mc[1];
the next step for me is to get the angle between these two points. By looking at the example throughout the net, the point2f must be separated to x1,y1 and x2,y2 so I can calculate the atan for the angle.
THe problem here I could not manage to get the values inside mc[0] and mc[1] for x1,y1 and x2,y2.
what I had tried and failed is using this statement
float x1,x2,y1,y2;
[x1,y1] = mc[0];
Anyone would help on this? Or is there any faster way to find the atan - angle for the two centroids coordinate I have obtained?Wed, 30 Sep 2015 03:03:54 -0500http://answers.opencv.org/question/71901/how-to-separate-the-point2f-to-other-variable/Comment by zms for <p>Hello,
I had obtained the centroid coordinate in terms of float and array, Point2f a = mc[0]; Point2f b = mc[1];</p>
<p>the next step for me is to get the angle between these two points. By looking at the example throughout the net, the point2f must be separated to x1,y1 and x2,y2 so I can calculate the atan for the angle. </p>
<p>THe problem here I could not manage to get the values inside mc[0] and mc[1] for x1,y1 and x2,y2.</p>
<p>what I had tried and failed is using this statement</p>
<p>float x1,x2,y1,y2;
[x1,y1] = mc[0];</p>
<p>Anyone would help on this? Or is there any faster way to find the atan - angle for the two centroids coordinate I have obtained?</p>
http://answers.opencv.org/question/71901/how-to-separate-the-point2f-to-other-variable/?comment=71976#post-id-71976@thdrksdfthmn sorry to make you surprise for the question :) . I'm quite a beginner person on this. Anyway, the solution above is correct. TQSM!! :)Thu, 01 Oct 2015 02:14:16 -0500http://answers.opencv.org/question/71901/how-to-separate-the-point2f-to-other-variable/?comment=71976#post-id-71976Comment by thdrksdfthmn for <p>Hello,
I had obtained the centroid coordinate in terms of float and array, Point2f a = mc[0]; Point2f b = mc[1];</p>
<p>the next step for me is to get the angle between these two points. By looking at the example throughout the net, the point2f must be separated to x1,y1 and x2,y2 so I can calculate the atan for the angle. </p>
<p>THe problem here I could not manage to get the values inside mc[0] and mc[1] for x1,y1 and x2,y2.</p>
<p>what I had tried and failed is using this statement</p>
<p>float x1,x2,y1,y2;
[x1,y1] = mc[0];</p>
<p>Anyone would help on this? Or is there any faster way to find the atan - angle for the two centroids coordinate I have obtained?</p>
http://answers.opencv.org/question/71901/how-to-separate-the-point2f-to-other-variable/?comment=72002#post-id-72002No problem, so good luck learning!Thu, 01 Oct 2015 05:12:02 -0500http://answers.opencv.org/question/71901/how-to-separate-the-point2f-to-other-variable/?comment=72002#post-id-72002Answer by thdrksdfthmn for <p>Hello,
I had obtained the centroid coordinate in terms of float and array, Point2f a = mc[0]; Point2f b = mc[1];</p>
<p>the next step for me is to get the angle between these two points. By looking at the example throughout the net, the point2f must be separated to x1,y1 and x2,y2 so I can calculate the atan for the angle. </p>
<p>THe problem here I could not manage to get the values inside mc[0] and mc[1] for x1,y1 and x2,y2.</p>
<p>what I had tried and failed is using this statement</p>
<p>float x1,x2,y1,y2;
[x1,y1] = mc[0];</p>
<p>Anyone would help on this? Or is there any faster way to find the atan - angle for the two centroids coordinate I have obtained?</p>
http://answers.opencv.org/question/71901/how-to-separate-the-point2f-to-other-variable/?answer=71905#post-id-71905 `Point2f` has 2 members: `x` and `y`, so you can just call them: `a.x` and `a.y`Wed, 30 Sep 2015 03:46:14 -0500http://answers.opencv.org/question/71901/how-to-separate-the-point2f-to-other-variable/?answer=71905#post-id-71905