【问题标题】:C++ OpenCV equivalent for C# EmguCV Image.setValue(...) methodC# EmguCV Image.setValue(...) 方法的 C++ OpenCV 等效项
【发布时间】:2012-05-03 07:58:16
【问题描述】:

如果有人可以分享代码

什么是 C# EmguCV 框架中 Image.setValue(...) 方法的 C++(OpenCV) 等效项。 emgucv 参考: http://www.emgu.com/wiki/files/2.3.0/document/Index.html

例如接下来如何用 C++ 编写代码:

 private static Image<Gray, Byte> FilterPlate(Image<Gray, Byte> plate)
 {
  ...
  Image<Gray, Byte> thresh = plate.ThresholdBinaryInv(new Gray(120), new Gray(255));
  using (Image<Gray, Byte> plateMask = new Image<Gray, byte>(plate.Size))
  plateMask.SetValue(255.0);
  ...
  thresh.SetValue(0, plateMask);
  }

尤其是下一个 C++ 等价物:

  thresh.SetValue(0, plateMask);

谢谢。

【问题讨论】:

    标签: c# c++ opencv emgucv


    【解决方案1】:

    我没有使用 EmguCV,但正如文档所述

     thresh.SetValue(0, plateMask);
    

    将Array的元素设置为val,使用特定的掩码

    所以,我认为,你可以使用

    void cvSet(CvArr* arr, CvScalar 值, const CvArr* mask=NULL)

    Sets every element of an array to a given value.
    

    http://opencv.willowgarage.com/documentation/operations_on_arrays.html#set

    例子:

    cvSet(thresh, CvScalar(0), plateMask);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-08
      • 1970-01-01
      • 2020-01-02
      • 1970-01-01
      • 1970-01-01
      • 2012-04-01
      • 2021-05-15
      • 2015-04-25
      相关资源
      最近更新 更多