OpenCV Mat masking based on condition in c#
<p>I am trying to implement MaxRGB filter in OpenCvSharp. I have found similar <a href="http://www.pyimagesearch.com/2015/09/28/implementing-the-max-rgb-filter-in-opencv/" rel="nofollow">solution in Python</a>, but I don't know how to write <code>R[R&lt;M]=0</code> in OpenCvSharp or in C++. It means to set 0 for value in channel where value is less than value in mask.</p>

<pre><code>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 &lt; M] = 0
G[G &lt; M] = 0
B[B &lt; M] = 0

# merge the channels back together and return the image
return cv2.merge([B, G, R])
</code></pre>

<p>What is the C#/C++ alternative for <code>R[R &lt; M] = 0</code>? Or will I have to use regular loops?</p>