/* //图片基本处理 */ #ifndef DrawImgl_H_ #define DrawImg_H_ #include #include #include "ImgCheckConfig.h" #include "JsonCoversion.h" #include #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 &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 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 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 &pOneImgDetResult); std::string GetResultString(std::shared_ptr &pOneImgDetResult); private: std::shared_ptr m_pOneImgDetResult; }; #endif