c – 具有纹理的阈值图像如何?通过tesseract识别
发布时间:2020-12-16 07:11:39 所属栏目:百科 来源:网络整理
导读:来源图片: 目的地图片: 码: cv::Mat sharpenedLena;cv::Mat kernel = (cv::Mat_float(3,3) 0,-1,5,0);cv::filter2D(matGrey,sharpenedLena,matGrey.depth(),kernel);cv::adaptiveThreshold(sharpenedLena,matBinary,255,cv::ADAPTIVE_THRESH_GAUSSIAN_C,C
来源图片:
目的地图片: 码: cv::Mat sharpenedLena; cv::Mat kernel = (cv::Mat_<float>(3,3) << 0,-1,5,0); cv::filter2D(matGrey,sharpenedLena,matGrey.depth(),kernel); cv::adaptiveThreshold(sharpenedLena,matBinary,255,cv::ADAPTIVE_THRESH_GAUSSIAN_C,CV_THRESH_BINARY,55,30); cv::Mat dst_img1; //cv::GaussianBlur(matBinary,dst_img1,cv::Size(3,3),0); cv::medianBlur(matBinary,3); UIImage *addrUIImage = [ImageUtil UIImageFromCVMat:dst_img1]; [self recognizeImageWithTesseract:addrUIImage withLauange:1]; 结果:
我认为这应该是解决问题的图片.这里有其他人的治疗效果.如何实现这种效果? 目标图片: 解决方法
这是我的结果&代码片段:
Mat mSource_Bgr,mSource_Gray,mSource_Hsv,mThreshold; mSource_Bgr= imread(FileName_S.c_str(),1); namedWindow("Source Image",WINDOW_AUTOSIZE); imshow("Source Image",mSource_Bgr); cvtColor(mSource_Bgr,COLOR_BGR2HSV); mSource_Hsv = mSource_Hsv + Scalar(0,-25); //Subtracting 25 from all the Pixel Values cvtColor(mSource_Hsv,mSource_Bgr,COLOR_HSV2BGR);// Back to BGR Just for Debug purpose imshow("Improved Darkness",mSource_Bgr); imwrite(FileName_S+"_Res.bmp",COLOR_BGR2GRAY); // for Adaptive Thresholding the input Image adaptiveThreshold(mSource_Gray,mThreshold,ADAPTIVE_THRESH_GAUSSIAN_C,THRESH_BINARY,59,10); imshow("Adaptive Thres",mThreshold); imwrite(FileName_S+"_Thres.bmp",mThreshold); 您可以使用轮廓区域或形态处理来移除噪点,即小点.希望这对您有所帮助! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |