1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- // 下列 ifdef 块是创建使从 DLL 导出更简单的
- // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 {0}_EXPORTS
- // 符号编译的。在使用此 DLL 的
- // 任何项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
- // {0}_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
- // 符号视为是被导出的。
- #ifdef CV_EXPORTS
- #define CV_API __declspec(dllexport)
- #else
- #define CV_API __declspec(dllimport)
- #endif
- // 此类是从 dll 导出的
- //class CV_API Ccv {
- //public:
- // Ccv(void);
- // // TODO: 在此处添加方法。
- //};
- //
- //extern CV_API int ncv;
- //
- //CV_API int fncv(void);
- //////////////////////////////////////////////////////////////////////////
- // gdiplus;
- // 初始化gdiplus环境;
- CV_API void InitGdiplus();
- // 关闭gdiplus环境;
- CV_API void ShutGdiplus();
- // 读取图片,返回gdiplus对象;
- CV_API bool GdiplusReadImage(std::string strImgPath, Gdiplus::Bitmap **bitmap);
- CV_API bool GdiReadImage(std::string strImgPath, CBitmap &bitmap);
- //////////////////////////////////////////////////////////////////////////
- // opencv;
- // 1、读取图片;
- CV_API bool ReadImage(std::string strImgPath, cv::Mat& img);
- // 2、获取图片全局二值化轮廓图像结果
- CV_API bool GetBinaryImage(std::string strImgPath, long nThresholdVal, long nMaxThresholdVal, cv::Mat & thresholdImg);
- // 3、获取图片OTSU二值化轮廓图像结果
- CV_API bool GetOTSUBinaryImage(std::string strImgPath, long nThresholdVal, long nMaxThresholdVal, cv::Mat& thresholdImg);
- // 4、获取图片自适应二值化轮廓图像结果
- CV_API bool GetAdaptiveBinaryImage(std::string strImgPath, long nMaxThresholdVal, cv::Mat& thresholdImg);
- // 5、图片高斯模糊处理,cv::Size一般为(3,3)或(5,5)
- CV_API bool GaussianBlur(cv::Mat& img, cv::Size cvSize, cv::Mat& gaussImg);
- CV_API bool GaussianBlur(std::string strImgPath, cv::Size cvSize, cv::Mat& gaussImg);
- // 6、图片转灰阶处理(BGR三通道转单通道)
- CV_API bool Color2Gray(cv::Mat& img, cv::Mat& grayImg);
- CV_API bool Color2Gray(std::string strImgPath, cv::Mat& grayImg);
- // 7、灰阶图转BGR处理(单通道转BGR三通道)
- CV_API bool Gray2Color(cv::Mat& img, cv::Mat& colorImg);
- // 8、对图片腐蚀处理
- CV_API bool ErodeImg(cv::Mat& img, cv::MorphShapes kernelShape, cv::Size kernelSize, cv::Mat& erodeImg);
- // 9、对图片膨胀处理
- CV_API bool DilateImg(cv::Mat& img, cv::MorphShapes kernelShape, cv::Size kernelSize, cv::Mat& dilateImg);
- // 10、裁剪图片指定区域
- CV_API bool CutPictures(cv::Mat& img, cv::Rect cvRect, cv::Mat& roiImg);
- CV_API bool CutPictures(std::string strImgPath, cv::Rect cvRect, cv::Mat& roiImg);
- CV_API bool CutPictures(std::string strImgPath, cv::Rect cvRect, std::string strRoiImgPath);
- // 11、输出图片二值化轮廓填充图像结果;
- // binImg必须为单通道
- // drawimg必须在binImg基础上Copyto或在原图上Copyto,即drawImg必须是binImg的克隆或原图的克隆;
- // 如果drawImg空,则从函数内部使用binImg来克隆;
- CV_API bool DrawContours(cv::Mat& binImg, cv::Mat& drawImg, bool InternalContour, bool bPerimeter, long nMinPerimeter, long nMaxPerimeter, bool bArea, long nMinArea, long nMaxArea);
- // 12、单个模板图片匹配
- CV_API bool MatchSingleImage(cv::Mat& img, cv::Mat templImg, double& matchVal, cv::Rect& matchRect);
- CV_API bool MatchSingleImage(cv::Mat& img, std::string strTmpImg, double &matchVal, cv::Rect &matchRect);
- CV_API bool MatchSingleImage(std::string strImg, std::string strTmpImg, double& matchVal, cv::Rect& matchRect);
- // 13、将opencv Mat对象转为GDI Bitmap对象和GDI+ Bitmap对象;
- CV_API bool Mat2Bitmap(cv::Mat &img, CBitmap &bitmap);
- CV_API bool Mat2HBitmap(cv::Mat& img, HBITMAP& bitmap);
- CV_API bool Mat2GdiplusBitmap(cv::Mat& img, Gdiplus::Bitmap& bitmap);
- CV_API bool Bitmap2Mat(CBitmap& bitmap, cv::Mat& img);
- CV_API bool HBitmap2Mat(HBITMAP& bitmap, cv::Mat& img);
- CV_API bool GdiplusBitmap2Mat(Gdiplus::Bitmap* bitmap, cv::Mat& img);
- // 待开发
- // 11、获取图片指定RGB颜色域的轮廓图像结果
- // 12、多个模板图片匹配
- // 13、获取图片的LUV平均值
- // 14、两图片相似度比较
|