//g++ rect.cpp `pkg-config opencv --cflags --libs` -o run
#include <opencv2/opencv.hpp>
#include<iostream>
using namespace std;
using namespace cv;
int main()
{
cv::Mat img = cv::imread("1.jpg", 1);
cv::rectangle(img, cv::Point(400, 400), cv::Point(400, 400), cv::Scalar(255, 250, 0, 0), 3);
imshow("img",img);
waitKey(0);
// cout << img<<endl;
// cout << "step:" << img.step << endl;
// cout << "step[0]:" << img.step[0] << endl;
// cout << "step[1]:" << img.step[1] << endl;
// cout << "step1(2):" << img.step1(2) << endl;
// cout << "step1(3):" << img.step1(3) << endl;
}
OpenCV画矩形框
最新推荐文章于 2025-06-09 23:37:47 发布