Ask Your Question
0

Check if binary mask is not empty?

asked 2013-06-11 08:25:57 -0600

tenac gravatar image

Hi!

Is there an efficient way to check if a binary mask is not empty, i.e. there is at least one non-zero pixel? I know the function countNonZero() but it causes a slight overhead for my intention since I am not interested in the actual pixel count. Therefore it would be possible to early terminate if any 'true' pixel is found - something like the Matlab function any()...

Greetings!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
-2

answered 2013-06-11 08:43:31 -0600

unxnut gravatar image

An easy way will be to use the function minMaxLoc and find the max value.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-11 08:25:57 -0600

Seen: 877 times

Last updated: Jun 11 '13