You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Cigarette/CigaretteSingle/AlgCommon.h

32 lines
1.2 KiB
C

#pragma once
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/types_c.h>
#define NOMINMAX
#include <windows.h>
#include <string>
//<2F><><EFBFBD><EFBFBD>rect<63>߽磬<DFBD><E7A3AC>ֹԽ<D6B9><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɳ<EFBFBD><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bool protectRect(cv::Rect& rect, int width, int height);
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
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);
//<2F><>ʾӢ<CABE><D3A2><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void putTextCorner(cv::Mat& image, std::string text, cv::Scalar color, int where);
//<2F>ȸ<EFBFBD>ʴ<EFBFBD><CAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void fistEROthenDIL(cv::Mat& input, uint8_t EROsize,uint8_t DILsize);
//<2F><><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD>ʴ
void fistDILthenERO(cv::Mat& input, uint8_t DILsize, uint8_t EROsize);
//<2F>жϾ<D0B6><CFBE><EFBFBD>1<EFBFBD>Ƿ<EFBFBD><C7B7>ھ<EFBFBD><DABE><EFBFBD>2<EFBFBD><32>
bool isInside(cv::Rect rect1, cv::Rect rect2);
//<2F><><EFBFBD>þ<EFBFBD><C3BE><EFBFBD><EFBFBD>е<EFBFBD>
cv::Point getCenterPoint(cv::Rect rect);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>η<EFBFBD>Χ
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);