|
|
#pragma once
|
|
|
#include <opencv2/opencv.hpp>
|
|
|
#include <opencv2/imgproc/types_c.h>
|
|
|
#define NOMINMAX
|
|
|
#include <windows.h>
|
|
|
#include <string>
|
|
|
|
|
|
//保护rect边界,防止越界访问造成程序崩溃
|
|
|
bool protectRect(cv::Rect& rect, int width, int height);
|
|
|
|
|
|
//显示中文
|
|
|
void GetStringSize(HDC hDC, const char* str, int* w, int* h);
|
|
|
void putTextZH(cv::Mat& dst, const char* str, cv::Point org, cv::Scalar color, int fontSize,
|
|
|
const char* fn = "Arial", bool italic = false, bool underline = false);
|
|
|
//显示英文文本在某个角落
|
|
|
void putTextCorner(cv::Mat& image, std::string text, cv::Scalar color, int where);
|
|
|
//先腐蚀后膨胀
|
|
|
void fistEROthenDIL(cv::Mat& input, uint8_t EROsize,uint8_t DILsize);
|
|
|
//先膨胀后腐蚀
|
|
|
void fistDILthenERO(cv::Mat& input, uint8_t DILsize, uint8_t EROsize);
|
|
|
//判断矩形1是否在矩形2中
|
|
|
bool isInside(cv::Rect rect1, cv::Rect rect2);
|
|
|
//获得矩形中点
|
|
|
cv::Point getCenterPoint(cv::Rect rect);
|
|
|
//扩大矩形范围
|
|
|
cv::Rect rectCenterScale(cv::Rect rect, cv::Size size);
|
|
|
//rgb2cmyk
|
|
|
cv::Mat rgb2cmyk(cv::Mat& rgb);
|
|
|
bool sort_rect_by_x_center(cv::Rect r1, cv::Rect r2);
|
|
|
bool sort_rect_by_height(cv::Rect r1, cv::Rect r2);
|
|
|
bool sort_rect_by_y_center(cv::Rect r1, cv::Rect r2);
|
|
|
bool sort_rect_by_width(cv::Rect r1, cv::Rect r2); |