基于c#条件的OpenCV Mat掩码

时间:2016-10-13 12:22:04

标签: c# python c++ opencv opencvsharp

我正在尝试在OpenCvSharp中实现MaxRGB过滤器。我找到了类似的solution in Python,但我不知道如何在OpenCvSharp或C ++中编写R[R<M]=0。这意味着在通道中将值设置为0,其中值小于掩码中的值。

def max_rgb_filter(image):
# split the image into its BGR components
(B, G, R) = cv2.split(image)

# find the maximum pixel intensity values for each
# (x, y)-coordinate,, then set all pixel values less
# than M to zero
M = np.maximum(np.maximum(R, G), B)
R[R < M] = 0
G[G < M] = 0
B[B < M] = 0

# merge the channels back together and return the image
return cv2.merge([B, G, R])

R[R < M] = 0的C#/ C ++替代方案是什么?或者我必须使用常规循环吗?

0 个答案:

没有答案