2012-05-03 72 views
0

如果有人可以共享C++ OpenCV的等同於C#EmguCV Image.setValue(...)方法

代碼什麼是C++(OpenCV的)等效Image.setValue(...)在C#EmguCV框架方法。 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); 

感謝。

回答

1

我不使用EmguCV,但文件說

thresh.SetValue(0, plateMask); 

設置數組爲val的元素,使用特殊掩模

所以,我認爲,你可以使用

空隙CVSET(CvArr * ARR,CvScalar值,常量CvArr *掩模= 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); 
+0

非常感謝您的幫助,kiwaa。 –