#include "stdafx.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv.hpp"
#include "windows.h"
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <io.h>
#include <vector>
#include <fstream>
#include <string>
#include <iostream>
#include<sstream>
using namespace std;
using namespace cv;
#pragma warning(disable:4996)
static Mat src, gray_src,drawImg;
static Mat cutSrc;
//src.copyTo(drawImg);
static int threshold_v = 80;
static int threshold_max = 100;
static char * title = "rectAndRound";
static RNG rng(12345);
int nHeight; //图像宽
int nWidth; //图像高
int nBufferDist = 100;//图像中心矩形宽和高
Point photoCenterPoint;//图像中心点坐标
Rect photoCenterRect; //图像中心矩形
string itos(int i) // 将int 转换成string
{
stringstream s;
s << i;
return s.str();
}
static void m_contours(int, void *);
Mat resizeImag(cv::Mat imgSrc,float scale)
{
int nHeight = imgSrc.rows*scale;
int nWidth = imgSrc.cols*scale;
Size ResImgSize = Size(nWidth, nHeight);
Mat ResImg = Mat(ResImgSize, imgSrc.type());
resize(imgSrc, ResImg, ResImgSize, CV_INTER_CUBIC);
return ResImg;
}
void cutGrayImage(cv::Mat im
opencv 图像检测导出子图像
最新推荐文章于 2024-02-18 10:57:17 发布
本文详细介绍了如何利用OpenCV库在Python中进行图像检测,并将检测到的子图像进行保存。通过实例代码展示了从读取图像、应用检测算法到导出子图像的完整流程。
摘要由CSDN通过智能技术生成