cv::bitwise_not on cv::Mat matrix
opencv
Solution
I cannot get the sense of doing a bitwise not of a double (floating point) value: you will be doing bitwise operations also on the exponent (see here). All bits will be inverted, from 0 to 1 and viceversa. There is also a note on this aspect in the function documentation.
In case of a floating-point input array, its machine-specific bit representation (usually IEEE754-compliant) is used for the operation.
If you want zeros to become ones and viceversa, as you suggested, you could do:
cv::threshold(warpmask, warpmaskTemp,0.5,1.0,THRESH_BINARY_INV)
(see documentation) (and yes, you can use same matrix for input and destination).
Problem
I tried to cv::bitwise_not to a cv::Mat matrix of double values. I applied like ``` cv::bitwise_not(img, imgtemp); ``` `img` is `CV_64F` data of 0 and 1. But `imgtemp` has all nonsense data inside. I am expecting 0 in `img` to be 1 at `imgtemp` and 1 in `img` to be 0 at `imgtemp`. How to apply bitwise_not to a double Mat matrix? Thanks