//#include "cv.h"
//#include "highgui.h"
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/opencv.hpp>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <io.h>
#include <atlbase.h>
using namespace std;
using namespace cv;
int thresh = 50;
IplImage* img = NULL;
IplImage* img0 = NULL;
CvMemStorage* storage = NULL;
const char * wndname = "正方形检测 demo";
//angle函数用来返回(两个向量之间找到角度的余弦值)
double angle(CvPoint* pt1, CvPoint* pt2, CvPoint* pt0)
{
double dx1 = pt1->x - pt0->x;
double dy1 = pt1->y - pt0->y;
double dx2 = pt2->x - pt0->x;
double dy2 = pt2->y - pt0->y;
return (dx1*dx2 + dy1*dy2) / sqrt((dx1*dx1 + dy1*dy1)*(dx2*dx2 +
hough变换 矩形检测
最新推荐文章于 2024-06-19 18:38:53 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)