template<typename _Tp>
class cv::Point_< _Tp >
Template class for 2D points specified by its coordinates x
and y
.
An instance of the class is interchangeable with C structures, CvPoint and CvPoint2D32f . There is also a cast operator to convert point coordinates to the specified type. The conversion from floating-point coordinates to integer coordinates is done by rounding. Commonly, the conversion uses this operation for each of the coordinates. Besides the class members listed in the declaration above, the following operations on points are implemented:
pt1 = pt2 + pt3;
pt1 = pt2 - pt3;
pt1 = pt2 * a;
pt1 = a * pt2;
pt1 = pt2 / a;
pt1 += pt2;
pt1 -= pt2;
pt1 *= a;
pt1 /= a;
pt1 == pt2;
pt1 != pt2;
For your convenience, the following type aliases are defined:
Example:
Point2f a(0.3f, 0.f), b(0.f, 0.4f);
Point pt = (a + b)*10.f;
cout << pt.x << ", " << pt.y << endl;
- Examples:
- samples/cpp/camshiftdemo.cpp, samples/cpp/convexhull.cpp, samples/cpp/create_mask.cpp, samples/cpp/demhist.cpp, samples/cpp/facedetect.cpp, samples/cpp/falsecolor.cpp, samples/cpp/ffilldemo.cpp, samples/cpp/fitellipse.cpp, samples/cpp/grabcut.cpp, samples/cpp/kalman.cpp, samples/cpp/kmeans.cpp, samples/cpp/minarea.cpp, samples/cpp/squares.cpp, samples/cpp/tutorial_code/Histograms_Matching/MatchTemplate_Demo.cpp, samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_1.cpp, samples/cpp/tutorial_code/ImgProc/basic_drawing/Drawing_2.cpp, samples/cpp/tutorial_code/ImgTrans/houghcircles.cpp, samples/cpp/tutorial_code/ImgTrans/houghlines.cpp, samples/cpp/tutorial_code/ml/introduction_to_pca/introduction_to_pca.cpp, samples/cpp/tutorial_code/photo/seamless_cloning/cloning_demo.cpp, samples/cpp/watershed.cpp, samples/dnn/classification.cpp, samples/dnn/object_detection.cpp, samples/dnn/openpose.cpp, and samples/tapi/squares.cpp.