资讯详情

opencv图像操作——轮廓周围绘制矩形

首先,将图像变成二值图像 找到轮廓,找到图像轮廓 通过相关API在轮廓点找到最小的矩形和圆,旋转矩形和椭圆 绘制他们

代码如下:

#include<opencv2/opencv.hpp> #include<iostream>  using namespace std; using namespace cv; Mat src, dst, gray_src; int threshold_value = 100; int threshold_max = 255; const char* output_title = "result image"; const char* trackbar_title = "Threshold Value"; void Contours_Callback(int, void*); RNG rng(12345); int main(int argc, char** argv) {   src = imread("1.png");  //D:\\sougou\\image\\2.jpg  9.jpg    if (!src.data) {   printf("could not load image...\n");   return -1;  }  char input_image[] = "input image";  namedWindow(input_image, WINDOW_AUTOSIZE);  namedWindow(output_title, WINDOW_AUTOSIZE);  imshow(input_image, src);  cvtColor(src, gray_src, CV_BGR2GRAY);  //imshow("gray image

标签: 连接器矩形重载热流插头ha矩形连接器y27g矩形连接器lcaxn500

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台