skimage2.measure.grid_points_in_poly#
- skimage2.measure.grid_points_in_poly(shape, verts, binarize=True)[source]#
Test whether points on a specified grid are inside a polygon.
For each
(r, c)coordinate on a grid, i.e.(0, 0),(0, 1)etc., test whether that point lies inside a polygon.You can control the output type with the
binarizeflag. Please refer to its documentation for further details.- Parameters:
- shapetuple (M, N)
Shape of the grid.
- verts(V, 2) array
Specify the V vertices of the polygon, sorted either clockwise or anti-clockwise. The first point may (but does not need to be) duplicated.
- binarizebool
If
True, the output of the function is a boolean mask. Otherwise, it is a labeled array. The labels are: 0 - outside, 1 - inside, 2 - vertex, 3 - edge.
- Returns:
- maskndarray of shape (M, N)
If
binarizeis True, the output is a boolean mask. True means the corresponding pixel falls inside the polygon. Ifbinarizeis False, the output is a labeled array, with pixels having a label between 0 and 3. The meaning of the values is: 0 - outside, 1 - inside, 2 - vertex, 3 - edge.
See also