Ask Your Question

Revision history [back]

i hope this will be helpful

#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>

using namespace cv;

int main()
{
    int lineType = LINE_AA; // change it to LINE_8 to see non-antialiased graphics

    Mat image = Mat::zeros(400, 400, CV_8UC3);

    for(int angle = 0; angle<360; )
    { 
        Point center(200, 200);
        Point perimeter;
        int radius = 150;

        Scalar randomColor((rand() & 255), (rand() & 255), (rand() & 255));
        ellipse( image, center, Size(radius, radius), angle, 45, 0, randomColor, 2, lineType);

        perimeter.x = (int)round(center.x + radius   * cos(angle * CV_PI / 180.0));
        perimeter.y = (int)round(center.y + radius  * sin(angle * CV_PI / 180.0));
        line(image, center, perimeter, randomColor, 2, lineType);

        angle = angle + 45;

        perimeter.x = (int)round(center.x + 150 * cos(angle * CV_PI / 180.0));
        perimeter.y = (int)round(center.y + 150 * sin(angle * CV_PI / 180.0));
        line(image, center, perimeter, randomColor, 2, lineType);

        imshow("slices", image);
        waitKey(0);
    }
    return 0;
}

image description

image description