1 | initial version |
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
2 | No.2 Revision |
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