简体   繁体   中英

OpenCV C++ Mat == operator

I'm using open CV in C++ , but i need some help at this example:

getContours((mask == 0), contours, hierarchy)

where this function just call findContours function from Open CV. I don't understand what really does mask == 0 as a parameter. mask is defined as a Mat data type. It`sa binary image black & white.

The == is a Matrix Expression that produces a binary matrix (of type CV_8UC1 ).

mask == 0 creates a binary mask where pixels are set to 255 if it was 0 in mask , or 0 otherwise.

If mask is binary, you're basically inverting it, same as ~mask .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM