cv3.draw.vline

cv3.draw.vline(img, x, rel=None, color=None, t=None, line_type=None, copy=False)[source]

Draw a vertical line on an image.

Parameters:
  • img (numpy.ndarray) – Input image to draw on.

  • x (int or float) – X-coordinate of the vertical line.

  • rel (bool, optional) – Whether to use relative coordinates. Defaults to None.

  • color – Color of the line (default: opt.COLOR).

  • t – Thickness of the line (default: opt.THICKNESS).

  • line_type – Type of line for drawing (default: opt.LINE_TYPE).

  • copy (bool) – Whether to copy the image before drawing (default: False).

Returns:

Image with the vertical line drawn on it.

Return type:

numpy.ndarray

Note

Relative coordinates are in the range [0, 1] where 0 is the left and 1 is the right of the image.

Example

>>> import cv3
>>> img = cv3.zeros(100, 100, 3)
>>> # Draw a vertical line in the middle
>>> img = cv3.vline(img, 50, color='red', t=2)
>>> # Draw a vertical line using relative coordinates
>>> img = cv3.vline(img, 0.75, rel=True, color='blue')