-1

I frequently encounter that issue but I don't really know a proper way to fix it. I just would like some advise to do it the regarding to the processing time.

I am using opencv and I want to realize that operation:

map |= mask & mu(0);

map is a matrix of single precision float.

mask is a matrix of unsigned char that only contain 0 for the statement false ot 255 (0xFF) for the statement true

mu is a double precision float scalar value.

Usually I do realize that operation that way :

cv::multiply(mask,mu(0),mask, 1./255., CV_32F);
map |= mask

Regarding also to the transparent vectorize classes (header openc2/core/hal/intrinsics.hpp) is there a more efficient way to do such operation ?

Thank you in advance for any help.

John_Sharp1318
  • 939
  • 8
  • 19
  • 2
    how about bitwise opencv operations like [bitwise_and](https://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html#bitwise-and) it accepts mat and scalar. – api55 Feb 21 '18 at 09:24
  • You are right the bitwise_or (bitwise_and and bitwise_xor as well) can have a mask as parameter. So my equation can be fix using bitwise_or(map,mu,map,mask). Thank you for your help :). – John_Sharp1318 Feb 21 '18 at 12:36

1 Answers1

0

As highlighted by api55 could be fix by using directly the bitwise function rather than using the operator overload.

Thank you api55

John_Sharp1318
  • 939
  • 8
  • 19