我不需要阈值图像。我想要门槛。我在OpenCV中发现了这一点。在emgu cv中查找otsu阈值的功能是什么?
cv::threshold(orig_img, thres_img, 0, 255, CV_THRESH_BINARY+CV_THRESH_OTSU);
在EmguCv中是否有等价物?提前致谢。
PS。我需要使用此阈值Canny边缘检测器
我不需要阈值图像。我想要门槛。我在OpenCV中发现了这一点。在emgu cv中查找otsu阈值的功能是什么?
cv::threshold(orig_img, thres_img, 0, 255, CV_THRESH_BINARY+CV_THRESH_OTSU);
在EmguCv中是否有等价物?提前致谢。
PS。我需要使用此阈值Canny边缘检测器
您可以将此代码引用到Auto Canny Edge检测器!
Image<Gray, byte> Img_Source_Gray = Img_Org_Gray.Copy();
Image<Gray, byte> Img_Egde_Gray = Img_Source_Gray.CopyBlank();
Image<Gray, byte> Img_SourceSmoothed_Gray = Img_Source_Gray.CopyBlank();
Image<Gray, byte> Img_Otsu_Gray = Img_Org_Gray.CopyBlank();
Img_SourceSmoothed_Gray = Img_Source_Gray.SmoothGaussian(3);
double CannyAccThresh = CvInvoke.cvThreshold(Img_EgdeNR_Gray.Ptr, Img_Otsu_Gray.Ptr, 0, 255, Emgu.CV.CvEnum.THRESH.CV_THRESH_OTSU | Emgu.CV.CvEnum.THRESH.CV_THRESH_BINARY);
double CannyThresh = 0.1 * CannyAccThresh;
Img_Otsu_Gray.Dispose();
Img_Egde_Gray = Img_SourceSmoothed_Gray.Canny(CannyThresh, CannyAccThresh);
imageBox2.Image = Img_Egde_Gray;
谢谢。有用!。我不知道你可以直接使用CvInvoke来调用OpenCV函数。 – Siddarth 2014-09-24 16:42:41
我知道这篇文章是相当古老的,但有没有人知道EmguCV 3.x的等价代码?因为它不包含函数CvInvoke.cvThreshold和枚举Emgu.CV.CvEnum.THRESH。 – 2018-02-09 14:21:57
不知道emgu,但cv :: threshold的*返回值*是上述情况下的otsu阈值。 (所以你可能仍然需要调用cv :: threshold,即使你扔掉thresh_img) – berak 2014-09-23 08:23:36
谢谢!我通过CvInvoke调用了阈值函数,它的工作原理 – Siddarth 2014-09-30 05:28:48