draw_line_image#

cbclib.bin.draw_line_image(shape: Tuple[int, Ellipsis], lines: Union[numpy.ndarray, Sequence[numpy.ndarray]], dilation: float = 0.0, profile: str = 'gauss', num_threads: int = 1)[source]#

Draw thick lines with variable thickness and the antialiasing applied on a single frame. The lines must follow the LSD convention, see the parameters for more info.

Parameters
  • inp – Input array.

  • lines (Union[numpy.ndarray, Sequence[numpy.ndarray]]) –

    A dictionary of the detected lines. Each array of lines must have a shape of (N, 7), where N is the number of lines. Each line is comprised of 7 parameters as follows:

    • [x0, y0], [x1, y1] : The coordinates of the line’s ends.

    • width : Line’s width.

    • p : Angle precision [0, 1] given by angle tolerance over 180 degree.

    • -log10(NFA) : Number of false alarms.

  • max_val – Maximum pixel value of a drawn line.

  • dilation (float) – Size of the binary dilation applied to the output array.

  • profile (str) –

    Line width profiles. The following keyword values are allowed:

    • tophat : Top-hat (rectangular) function profile.

    • linear : Linear (triangular) function profile.

    • quad : Quadratic (parabola) function profile.

    • gauss : Gaussian funtion profile.

  • num_threads (int) – Number of threads used in the calculations.

Raises
  • ValueError – If inp number of dimensions is less than 3.

  • ValueError – If any of lines dictionary values have an incompatible shape.

  • RuntimeError – If C backend exited with error.

Returns

Output array with the lines drawn.

Return type

numpy.ndarray

See also

cbclib.bin.LSD : Line Segment Detector.