0

At a point in my code I have a cv::Mat with the type CV_8U and a cv::Mat with the type CV_64f. I want to know if there is a clever way to masking the floating point image with the char image without having to loop through the images and do it explicitly.

I realize this isn't a terribly pressing issue to just write, I'm just curious if it is possible to help with readability succinctness in my code.

4

1 回答 1

1

I realized I was thinking about the operation the wrong way. Masking the floating point image is the same as an element-wise matrix multiplication of a binary image. An easy way to do this operation is

cv::Mat result = floatImg.mul(mask);

cv::Mat.mul() can be found in the documentation here.

于 2013-04-15T02:57:15.203 回答