I am using OpenCV and need to do a shift right for each pixel in a Mat
. For example,
Mat m = ...;
int numbits = get_num_bits_from_the_user_input(...);
Mat a = m >> numbits; // this
However, I only see operators like &, |, ^, and so on (as well as function name like bitwise_and, bitwise_or, etc) in the official manual. I even dig into the source code but do not find the bit shift operations.
You know, this is a very common and useful operator. So how can I get that?
Of course I can use a division, like m / thedivisor
. However, as all know that, the division is far far slower than the bitwise operations. So I do not want to use it unless absolutely necessary.