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

68 lines
2.1 KiB

/*
//图片基本处理
*/
#ifndef DrawImgl_H_
#define DrawImg_H_
#include <vector>
#include <thread>
#include "ImgCheckConfig.h"
#include "JsonCoversion.h"
#include <stdio.h>
#include "ImageDetConfig.h"
using namespace std;
class DrawImg
{
public:
enum Draw_Type
{
Draw_Type_YS,
Draw_Type_NG,
Draw_Type_Other,
};
public:
DrawImg();
~DrawImg();
int DrawResult(std::shared_ptr<CheckResult> &result);
int DrawInfoImg(cv::Mat &img, cv::Rect roi, int blobidx, int type, float fArea, float fenerge, float fmaxv, float fhj, float flen, Draw_Type drayType, std::string strqx_error, std::string strqx_code, int qx_type, int qx_num, float mindis, bool bqxroi = false);
int DrawInfoImg_Src(cv::Mat &img, cv::Rect roi, int blobidx, int type, float fArea, float fenerge, float fmaxv, float fhj, float flen, Draw_Type drayType, std::string strqx_error, std::string strqx_code, int qx_type, int qx_num, float mindis, bool bqxroi = false);
int preDealImg(cv::Mat &srcimg, cv::Mat &image_resize, bool bfilpSrcImg = true);
int DrawPointList(cv::Mat &image_draw, std::vector<cv::Point> plist);
bool bdraw(cv::Rect roi);
public:
int font_face = cv::FONT_HERSHEY_SIMPLEX;
double font_scale = 0.5;
int thickness = 1;
bool m_bstatus_ReJson;
cv::Scalar Color_Brightness_roi = cv::Scalar(0, 255, 0);
cv::Scalar Color_Brightness_text = cv::Scalar(0, 255, 0);
cv::Scalar DrawBlobErrorCorleList[ERROR_TYPE_COUNT];
std::vector<cv::Rect> m_drawList;
private:
};
class CheckResultJson : public JsonCoversion
{
public:
CheckResultJson() {}
virtual ~CheckResultJson() {}
public:
virtual Json::Value toJsonValue();
virtual void toObjectFromValue(Json::Value root);
int GetConfig(std::string strJson, std::shared_ptr<One_Image_CheckResult_> &pOneImgDetResult);
std::string GetResultString(std::shared_ptr<One_Image_CheckResult_> &pOneImgDetResult);
private:
std::shared_ptr<One_Image_CheckResult_> m_pOneImgDetResult;
};
#endif