Ask Your Question

Revision history [back]

If the image is binary (1 and 0 values only), then you can use the function findNonZero() which gives you all pixels with a value, not equal to zero!

This is always more performant than going for a double for loop as suggested by @kieranfish

If the image is binary (1 and 0 values only), values, or 255 and 0 values), then you can use the function findNonZero() which gives you all pixels with a value, not equal to zero!

This is always more performant than going for a double for loop as suggested by @kieranfish