OpenCV various drawing straight Rectangle circle Ellipse

Source: Internet
Author: User

Drawing functions

(1) Linear cvline function

Its structure

void Cvline (//Draw line
  cvarr* array,//canvas image
  cvpoint pt1,//start point
  cvpoint pt2,//end
  cvscalar color,//color
  int thickness = 1,//width
  int connectivity = 8//anti-aliasing
);
Instance Code
#include <cv.h>
#include 
Output results


(2) Rectangle Cvrectangle function

Its structure

void Cvrectangle (//Draw rectangle
  cvarr* array,//canvas graphics
  cvpoint pt1,//start point cvpoint
  pt2,//end
  cvscalar color,//Color
  int thickness = 1,//width
);
Instance Code
#include <cv.h>
#include 
Output results


(3) Circular cvcircle function

Its structure

void Cvcircle (//Draw circle
  cvarr* array,//canvas image
  cvpoint cevter,//Center
  int radius,//radius
  cvscalar color,//Color
  int thickness = 1,//width
  int connectivity = 8//anti-aliasing
);
Instance Code
#include <cv.h>
#include 
Output results


(4) Elliptic cvellipse function

Its structure

void Cvellipse (//Draw ellipse
  cvarr* img,//canvas image
  cvpoint center,//center point cvsize axes,//Long and short
  axis
  double angle,//deviate from spindle angle
  Double start_angle,//arc start position
  Double end_angle,//arc End position
  cvscalar color,//color
  int thickness = 1,//width
  int line_type = 8//
);
Instance Code
#include <cv.h>
#include 
Output results


(5) Polygon function

1.cvFillPoly function

Its structure

void Cvfillpoly (//Draw multiple solid polygons
  cvarr* img,//canvas image
  cvpoint** pts,//point sequence
  int* npt,//count points array
  int contours,// Display several polygons
  cvscalar color,//color
  int line_type = 8
);
2.cvFillConvexPoly function

Its structure

void Cvfillconvexpoly (//Draw a solid polygon
  cvarr* img,//canvas image
  cvpoint* pts,//point sequence
  int npt,//count points array
  cvscalar color,//color
  int line_type = 8
);
3.cvPolyLine function
void Cvfillpoly (//Draw multiple hollow polygons
  cvarr* img,//canvas image
  cvpoint** pts,//point sequence
  int* npt,//count points array
  int contours,// Shows whether several polygon
  int is_closed,//start from the last polygon end point
  cvscalar color,//color
  int thickness = 1,//width
  int line_type = 8
);
Instance Code
#include <cv.h> #include Output results


(6) Draw text Cvputtext function

Its structure

void Cvputtext (//Draw text
  cvarr* img,//drawing image
  

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.