簡體   English   中英

與C#EmguCV Image.setValue(…)方法對應的C ++ OpenCV

[英]C++ OpenCV equivalent for C# EmguCV Image.setValue(…) method

如果有人可以共享以下代碼

什么是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);

謝謝。

我沒有使用EmguCV,但正如文檔所述

 thresh.SetValue(0, plateMask);

使用特定的掩碼將Array的元素設置為val

所以,我認為,您可以使用

無效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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM