Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

What is the best way to find bounding box for binary mask?

$
0
0
I have a binary mask of an object and want to get its bounding rectangle. Function cv::boundingRect wants a vector of cv::Point, while I have a matrix. I've written my own function, which reduces the binary mask with CV_REDUCE_MAX first to a column then to a row and finds leftmost and rightmost and topmost and bottommost non-zero elements. The mask is strictly binary (0 and 1). Is there any better way?

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>