cv3.draw.point

cv3.draw.point(img, x0, y0, r=None, rel=None, r_mode='min', color=None, copy=False)[source]

Draw a point (filled circle) on an image.

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

  • x0 (int or float) – X-coordinate of the point center.

  • y0 (int or float) – Y-coordinate of the point center.

  • r (int or float, optional) – Radius of the point. Defaults to opt.PT_RADIUS.

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

  • r_mode (str, optional) – Mode for relative radius calculation. One of ‘w’, ‘h’, ‘min’, ‘max’, ‘diag’. Only used when rel=True for the radius. Defaults to ‘min’. - ‘w’: Relative to image width - ‘h’: Relative to image height - ‘min’: Relative to minimum of width and height - ‘max’: Relative to maximum of width and height - ‘diag’: Relative to image diagonal

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

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

Returns:

Image with the point drawn on it.

Return type:

numpy.ndarray

Note

This function draws a filled circle (point) on the image. The thickness parameter ‘t’ is not used for points as they are always filled.

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

Example

>>> import cv3
>>> img = cv3.zeros(100, 100, 3)
>>> # Draw a point
>>> img = cv3.point(img, 50, 50, color='red')
>>> # Draw a point with custom radius
>>> img = cv3.point(img, 80, 80, r=5, color='blue')
>>> # Draw a point with relative radius based on image width
>>> img = cv3.point(img, 0.5, 0.5, r=0.1, rel=True, r_mode='w', color='green')