Issues (58)

patty/segmentation/segRedStick.py (1 issue)

1 1
import colorsys
0 ignored issues
show
Coding Style Naming introduced by
The name segRedStick does not conform to the module naming conventions ((([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
2 1
import numpy as np
3
4
5 1
def get_red_mask(pointcloud):
6
    """Returns a mask for the red parts of a pointcloud.
7
8
    Red points are points that have hue larger than 0.9
9
    and saturation larger than 0.5 in HSV colorspace.
10
    """
11
12 1
    red_mask = np.empty(len(pointcloud), dtype=np.bool)
13 1
    for i in xrange(len(pointcloud)):
14 1
        red, grn, blu = pointcloud[i][3:6]
15 1
        hue, sat, _ = colorsys.rgb_to_hsv(
16
            np.float32(red), np.float32(grn), np.float32(blu))
17 1
        red_mask[i] = hue > 0.9 and sat > 0.5
18
19
    return red_mask
20