banner



How To Draw A Rectangle In C# Console Application

How to depict a rectangle in OpenCV using C++?


To draw a rectangle, nosotros need 4 points. Wait at the following effigy.

In the effigy, at that place are four points x1, x2, y1 and y2. These iv points are forming the four coordinates. To draw a rectangle using OpenCV, nosotros have to define these points and evidence the rectangle we need a matrix. We have to declare other relevant values like the color of the line and line width.

The basic syntax of this method is as follows −

Syntax

rectangle(whiteMatrix, starting, ending, line_Color, thickness);

The following plan represents how to draw a rectangle in OpenCV.

Instance

#include<iostream> #include<opencv2/highgui/highgui.hpp> #include<opencv2/imgproc/imgproc.hpp> using namespace cv; using namespace std; int master() {    Mat whiteMatrix(200, 200, CV_8UC3, Scalar(255, 255, 255));// Declaring a white matrix//    Betoken starting(40, 40);//Declaring the starting coordinate//    Point ending(160, 100);//Declaring the ending coordinate    Scalar line_Color(0, 0, 0);//Color of the rectangle//    int thickness = 2;//thickens of the line//    namedWindow("whiteMatrix");//Declaring a window to evidence the rectangle//    rectangle(whiteMatrix, starting, catastrophe, line_Color, thickness);//Drawing the rectangle//    imshow("WhiteMatrix", whiteMatrix);//Showing the rectangle//    waitKey(0);//Waiting for Keystroke    return 0; }

Output

raja

Published on 10-Mar-2021 08:01:48

  • Related Questions & Answers
  • How to draw a rectangle in OpenCV using Java?
  • Draw rectangle on an image using OpenCV
  • How to draw a line in OpenCV using C++?
  • How to draw a circle in OpenCV using C++?
  • How to draw an Ellipse in OpenCV using C++?
  • How to depict a polygon in OpenCV using Java?
  • How to draw a line in OpenCV using Java?
  • How to draw a circle in OpenCV using Java?
  • How to describe polylines in OpenCV using Coffee?
  • How to draw a rectangle in HTML5 SVG?
  • How to describe a filled circumvolve in OpenCV using Java?
  • How to draw a filled ellipse in OpenCV using Coffee?
  • How to draw a filled polygon in OpenCV using Coffee?
  • How to draw a rectangle on HTML5 Canvass?
  • Draw a circle using OpenCV role circumvolve()

Source: https://www.tutorialspoint.com/how-to-draw-a-rectangle-in-opencv-using-cplusplus

Posted by: muellerthateadthe.blogspot.com

Related Posts

0 Response to "How To Draw A Rectangle In C# Console Application"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel