我正在尝试在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 ++替代方案是什么?或者我必须使用常规循环吗?