#include "pch.h"
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat img = imread("test.jpg");
//draw a line
line(img, Point(0, img.size().height / 2), Point(img.size().width, img.size().height / 2), Scalar(0, 0, 255));
//draw a rectangle
rectangle(img, Point(img.size().width/4, img.size().height/4), Point(img.size().width- img.size().width / 4, img.size().height - img.size().height/4), Scalar(0, 255, 255));
//draw a circle
circle(img, Point(img.size().width / 2, img.size().height / 2), 300, Scalar(255, 0, 255));
imshow("draw line", img);
imwrite("afterdraw.jpg", img);
waitKey(0);
}
C++ opencv 画线,矩形等
最新推荐文章于 2024-07-30 21:35:48 发布