In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this "C++ opencv how to achieve geometric drawing" article, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "C++ opencv how to achieve geometric drawing" article.
1. Rectangular rectangle ()
Draw a rectangle through two vertices on the diagonal
Void rectangle (InputOutputArray img, Rect rec, const Scalar& color, int thickness = 1, int lineType = LINE_8, int shift = 0); img name the vertex of rec pt1 rectangle pt2 and pt1 relative to the rectangular vertex color color can also be stored in pixels like Scalarthickness width if it is-1, it represents the number of decimal places in the lineType type shift shift coordinates of the changed rectangle.
Code:
Int main () {Mat img = Mat::ones (240,240, CV_8UC3); rectangle (img, Rect (20,20,100,100), Scalar (0,0,255,7); imshow ("www", img); waitKey (0);}
Effect picture:
two。 Circle circle () void circle (InputOutputArray img, Point center, int radius, const Scalar& color, int thickness = 1, int lineType = LINE_8, int shift = 0); img name center circle center coordinate color ring color thickness positive number, then the circle outline thickness negative number to the circle fill color lineType type shift shift center coordinates and radius value of decimal places.
Code:
Int main () {Mat img1=Mat::zeros (100,100, CV_8UC3); circle (img1, Point (40,40), 20, Scalar (0,0,255),-1); / /-1 fill imshow ("www", img1); waitKey (0);}
Effect picture:
3. The ellipse elliple () void ellipse (InputOutputArray img, Point center, Size axes, double angle, double startAngle, double endAngle, const Scalar& color, int thickness = 1, int lineType = LINE_8, int shift = 0); img name the center of the center ellipse. Axes axis half the size of the elliptical spindle. The rotation angle of the angle ellipse. The starting angle of the startAngle elliptical arc, expressed in degrees. The end angle of the endAngle elliptical arc, expressed in degrees. Color ellipse color. The thickness of the thickness positive ellipse arc profile is negative to fill the ellipse. Linetype elliptical boundary type. The number of decimal places for shift center coordinates and axis values.
Code:
Int main () {Mat img1 = Mat::zeros (300,300, CV_8UC3); ellipse (img1, Point (100,100), Size (40,25), 0,0,360, Scalar (0,0255,5); imshow ("111", img1); waitKey (0);}
Effect picture:
The above is about "C++ opencv how to achieve geometric drawing" this article, I believe we all have a certain understanding, I hope the editor to share the content to help you, if you want to know more related knowledge, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.