#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
Mat src_gray;
int thresh = 100;
RNG rng(12345);
void thresh_callback(int, void*);
int main(void)
{
Mat src = imread("../res/balloon.png");
if(src.empty())
{
cout << "can't load image" << endl;
return -1;
}
cvtColor(src, src_gray, cv::COLOR_BGR2GRAY);
blur(src_gray, src_gray, Size(3,3));
const char* source_window = "Source";
namedWindow(source_window);
imshow(source_window, src);
const int max_thresh =255;
createTrackbar("canny thresh:", source_window, &thresh, max_thresh, thresh_callback);
thresh_callback(0,0);
waitKey();
return 0;
};
void thresh_callback(int, void*)
{
Mat canny_output;
Canny(src_gray
轮廓的最小外接矩形、最小外接圆、三角形、椭圆等
最新推荐文章于 2024-06-03 16:55:27 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)