Im usign python and opencv to get a image from the webcam, and I want to know how to draw a circle over my image, just a simple green circle with transparent fill
my code:
import cv2 import numpy import sys if __name__ == '__main__': #get current frame from webcam cam = cv2.VideoCapture(0) img = cam.read() #how draw a circle???? cv2.imshow('WebCam', img) cv2.waitKey()
Thanks in advance.
Advertisement
Answer
cv2.circle(img, center, radius, color, thickness=1, lineType=8, shift=0) → None Draws a circle. Parameters: img (CvArr) – Image where the circle is drawn center (CvPoint) – Center of the circle radius (int) – Radius of the circle color (CvScalar) – Circle color thickness (int) – Thickness of the circle outline if positive, otherwise this indicates that a filled circle is to be drawn lineType (int) – Type of the circle boundary, see Line description shift (int) – Number of fractional bits in the center coordinates and radius value
Use “thickness” parameter for only the border.