Draw Marker on Image using OpenCV

Draw Marker on Image using OpenCV

OpenCV provides various functions for drawing geometric shapes such as line, rectangle, circle, etc.

The drawMarker function draws marker on an image by predefined x and y coordinates, marker type, size and other parameters.

Python
C++
Java
import cv2 import numpy as np img = np.zeros((100, 300, 3), dtype=np.uint8) x, y = 150, 50 color = (0, 255, 0) markerType = cv2.MARKER_CROSS markerSize = 15 thickness = 2 cv2.drawMarker(img, (x, y), color, markerType, markerSize, thickness) cv2.imshow('Image', img) cv2.waitKey(0) cv2.destroyAllWindows()

Result:

Draw Marker on Image using OpenCV

Leave a Comment

Cancel reply

Your email address will not be published.