OpenCV draw straight Round ellipse rectangle

Source: Internet
Author: User

Today to see the simple small program written earlier, suddenly want to tidy up, hope to be useful to everyone

#include <cv.h>

#include
#pragma comment (lib, "Cv.lib")
#pragma comment (lib, "Cxcore.lib")
#pragma comment (lib, "Highgui.lib")

int main ()
{
cvmat* SRCMAT1;
cvmat* SrcMat2;
cvmat* SRCMAT3;
cvmat* SRCMAT4;
int radius;
Double Angle,start_angle,end_angle;
Cvpoint Cirpoint1,cirpoint2;
Cvsize axes;
Cvscalar Circolor;


SRCMAT1 = Cvcreatemat (A. cv_8uc3);100*100 3-Channel byte type
SRCMAT2 = Cvcreatemat (A. cv_8uc3);100*100 3-Channel byte type
SRCMAT3 = Cvcreatemat (A. cv_8uc3);100*100 3-Channel byte type
SRCMAT4 = Cvcreatemat (A. cv_8uc3);100*100 3-Channel byte type


Cvsetzero (SRCMAT1);Clear Zero
Cvsetzero (SRCMAT2);Clear Zero
Cvsetzero (SRCMAT3);Clear Zero
Cvsetzero (SRCMAT3);Clear Zero
CirPoint1 = Cvpoint (150, 150); Coordinates one
CirPoint2 = Cvpoint (400, 400);Coordinate two
Axes=cvsize (140,60);
Radius = 40;//Radius
angle=0;
start_angle=0;
end_angle=360;
Circolor = Cvscalar (255, 255,255,0);//Blue

Cvline (SRCMAT1, CirPoint1, CirPoint2, circolor,1,8,0);Draw a Circle
Cvcircle (srcmat2,cirpoint1,radius,circolor,1,8,0);
Cvrectangle (srcmat3,cirpoint1,cirpoint2,circolor,1,8,0);
Cvellipse (srcmat4,cirpoint1,axes,angle,start_angle,end_angle,circolor,1,8,0);


Cvnamedwindow ("Exam301", cv_window_autosize);
Cvshowimage ("Exam301", (iplimage*) SRCMAT1);

Cvnamedwindow ("Exam302", cv_window_autosize);
Cvshowimage ("Exam302", (iplimage*) SRCMAT2);

Cvnamedwindow ("Exam303", cv_window_autosize);
Cvshowimage ("Exam303", (iplimage*) SRCMAT3);

Cvnamedwindow ("Exam304", cv_window_autosize);
Cvshowimage ("Exam304", (iplimage*) SRCMAT4);

Cvwaitkey (0);

Cvreleasemat (&AMP;SRCMAT1);
Cvreleasemat (&AMP;SRCMAT2);
Cvreleasemat (&AMP;SRCMAT3);
Cvreleasemat (&AMP;SRCMAT4);

Cvdestroywindow ("Exam301");
Cvdestroywindow ("Exam302");
Cvdestroywindow ("Exam303");
Cvdestroywindow ("Exam304");
return 0;
}

OpenCV draw straight Round ellipse rectangle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.