Ask Your Question

Generate 1C Mask

asked 2017-04-02 03:08:31 -0500

Adi gravatar image

updated 2017-04-02 03:10:28 -0500

Given a multichannel image (e.g. BGR), what's the most efficient way to generate a (binary) 1C mask for pixel value equality?

cv::compare() works only for single channel images.

Using op== yields a 3C mask.
I can then reduce that but that seems like a wasteful second pass.

Is there a single-pass way of doing this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-04-03 08:31:49 -0500

Adi gravatar image

Answering myself: use cv::inRange().
See also this SO answer.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-04-02 03:08:31 -0500

Seen: 255 times

Last updated: Apr 03 '17