Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

draw a circle over image opencv

Tags:

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

enter image description here

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.

like image 517
Art Grc Avatar asked May 10 '13 14:05

Art Grc


1 Answers

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.

like image 181
Abhishek Thakur Avatar answered Nov 03 '22 16:11

Abhishek Thakur