Ask Your Question
2

Is it possible to draw half circle?

asked 2014-04-05 08:59:05 -0600

gunslinger_ gravatar image

updated 2020-10-21 13:03:52 -0600

Simple question. Is it possible to draw half circle in OpenCV? If not, how can I do this especially in Python?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
3

answered 2014-04-05 11:47:58 -0600

Haris gravatar image

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.

edit flag offensive delete link more
4

answered 2016-12-19 05:20:35 -0600

Soltius gravatar image

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)
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-04-05 08:59:05 -0600

Seen: 8,306 times

Last updated: Dec 19 '16