0

我正在尝试在 OpenCvSharp 中实现 MaxRGB 过滤器。我在 Python 中找到了类似的解决方案,但我不知道如何用R[R<M]=0OpenCvSharp 或 C++ 编写。这意味着将通道中的值设置为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])

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

4

0 回答 0