Ask Your Question
0

Generate 1C Mask

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

Adi gravatar image

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

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
1

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

Adi gravatar image

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

edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 351 times

Last updated: Apr 03 '17