Boolean Not in OpenCV 3.1
<p>I would like to know if there's a simple way of doing a boolean "not" operation on a cv::Mat. This does not work:</p>

<pre><code>cv::Mat mat = cv::Mat::ones(3,3, CV_8U);
cv::Mat mat_not = !mat;
</code></pre>

<p>As such, is there an effective or simple way to do this? Should I resort to using something like this:</p>

<pre><code>cv::Mat mat_not = mat &lt; cv::Mat::ones(3,3,CV_8U);
</code></pre>

<p>Thanks a lot!</p>

<p>EDIT: I confused the "not" operator between MATLAB and C++ (since I'm translating the first one to the other). This works fine:</p>

<pre><code>cv::Mat map2 = ~map1;
</code></pre>