gpt4 book ai didi

c# - C# EmguCV Image.setValue(...) 方法的 C++ OpenCV 等价物

转载 作者:行者123 更新时间:2023-11-28 08:05:11 25 4
gpt4 key购买 nike

如果有人可以分享代码

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

Set the element of the Array to val, using the specific mask

所以,我想,你可以使用

void cvSet(CvArr* arr, CvScalar value, 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);

关于c# - C# EmguCV Image.setValue(...) 方法的 C++ OpenCV 等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10427338/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com