this is how you can do it with cv::ellipse
:
cv::Mat siemensStar(unsigned int radius, unsigned int number_of_pieces)
{
// create output image
cv::Mat star(2*radius, 2*radius, CV_8UC1, 255);
// center in the middle of the image
cv::Point2f center(radius,radius);
// angle of a single arc (mind that there is always one black and one white arc
float angle = 360.0f/(2*(float)number_of_pieces);
// draw all arcs
for(float i=0; i<360; i+=2*angle)
{
// draw the outlines anti-aliased or change the line type if you want
cv::ellipse(star, center, cv::Size(radius,radius), 0, i, i+angle, cv::Scalar(0),-1, CV_AA);
}
return star;
}
this works and gives me with the call cv::imshow("siemens star", siemensStar(256,16));
this result:
beware that this might not be what you want (since the optical effect in the center isnt really visible), but thats the problem of rastering (during drawing) I think. We don't work with vector images here. Maybe better if the number of elements is reduced...