【问题标题】:what is the function to find otsu threshold in emgu cv?在 emgu cv 中找到 otsu 阈值的功能是什么?
【发布时间】:2014-09-23 07:51:40
【问题描述】:

我不需要阈值图像。我要门槛。我在 OpenCV 中找到了这个。

cv::threshold( orig_img, thres_img, 0, 255, CV_THRESH_BINARY+CV_THRESH_OTSU );

EmguCv 中是否有等价物。提前致谢。

PS。我需要将此阈值用于精明的边缘检测器

【问题讨论】:

  • 不知道 emgu,但是 cv::threshold 的 返回值 是上述情况下的 otsu 阈值。 (所以你可能仍然需要调用 cv::threshold,即使你扔掉了 thresh_img)
  • 谢谢!我通过 CvInvoke 调用了阈值函数,它可以工作

标签: c# opencv emgucv


【解决方案1】:

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 函数。
  • 我知道这篇文章已经很老了,但有人知道 EmguCV 3.x 的等效代码吗?因为它不包含函数 CvInvoke.cvThreshold 和枚举 Emgu.CV.CvEnum.THRESH。
  • 这个帖子很旧,但在回答之前评论者的问题时,我在 Emgu.CV.CvEnum.ThresholdType.Otsu & Emgu.CV.CvEnum.ThresholdType.Binary 找到了新的枚举
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-25
  • 2012-10-08
  • 2022-06-22
  • 2019-03-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多