// opencvdrawrect.cpp : 定义控制台应用程序的入口点。
#include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <ctype.h>
#include <vector>
using namespace cv;
using namespace std;
float getdistance(Point pointO, Point pointA) //计算两点距离
{
float distance;
distance = powf((pointO.x - pointA.x), 2) + powf((pointO.y - pointA.y), 2);
distance = sqrtf(distance);
return distance;
}
class corner //角点
{
public:
Point lefttop;
Point righttop;
Point leftdown;
Point rightdown;
//下面的四个bool量表示目前鼠标关联修改的是哪个角点
bool lt = false; //lefttop
bool rt = false; //righttop
bool ld = false; //leftbottom
bool rd = false; //rightbottom
void resetcorner(); //角点刷新函数
};
void corner::resetcorner() //角点刷新函数
{
if (lt == true)
{
leftdown.x = lefttop.x;
righttop.y = lefttop.y;
}
else if (rt == true)
{