在OpenCV中将Point数据类型转换为int

Converting from Point datatype to int in OpenCV

本文关键字:类型转换 int 数据 Point OpenCV 中将      更新时间:2023-10-16

我正在编写一个程序,使用windows.h中定义的SetCursorPos()移动鼠标指针。SetCursorPos的参数应该是int。我有一个从矩形中得到的Point数据结构。如何转换?提前感谢:)

SetCursorPos定义为:

BOOL WINAPI SetCursorPos(
  _In_  int X,
  _In_  int Y
);

所以你可以使用:

 Point p;
 ....some code
 SetCursorPos(p.x,p.y);