Is it possible to draw half circle?
Simple question. Is it possible to draw half circle in OpenCV? If not, how can I do this especially in Python?
Simple question. Is it possible to draw half circle in OpenCV? If not, how can I do this especially in Python?
I have'nt tested it but I think it will work, instead of circle draw ellipse() but need to adjust the parameters, like
center=your half circle centre
axes = Size(radius ,radius);
angle=0;
startAngle=0;
endAngle=180;
Now draw ellipse like,
ellipse(img,Point(centX,centY), Size(radius,radiua),0,0,180, Scalar(0,0,255), 2, 8,0);
You can change start angle and stop angle and draw different area you need.
Great answer ! Just a small addition since the question was asked for Python, in case any Python user come by (also, this is a full working example)
import cv2
import numpy
img=numpy.zeros((100,100))
radius=5
axes = (radius,radius)
angle=0;
startAngle=0;
endAngle=180;
center=(50,50)
color=255
cv2.ellipse(img, center, axes, angle, startAngle, endAngle, color)
Asked: 2014-04-05 08:59:05 -0600
Seen: 8,254 times
Last updated: Dec 19 '16