'Select coordinates from image, based on certain criteria
Let's say I have an OpenCV image in form of a numpy array. I want to collect all (x, y) point coordinates of points that have greater than zero blue color component. The naive way would be something like this:
n_rows, n_cols, _ = image.shape
points = []
for row in range(n_rows):
for col in range(n_cols):
if image[row, col, 0] > 0:
points.append((row, col))
Is there a smarter and more efficient way to do the same, using numpy or OpenCV capabilities?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
