#include "opencv2\opencv.hpp"
#include <iostream>
using namespace cv;
int main()
{
Mat image;
image = imread("../../bin/data/1.jpg");
//截图区域(起点(650, 200)-宽高(600, 700))
Rect rect_car(650, 200, 600, 700);
Mat image_car = image(rect_car);
char image_name[20];
sprintf_s(image_name, "%s%s", "image截图", ".jpg");
std::string str(image_name);
imwrite("../../bin/data/" + str, image_car);
waitKey(0);
}
网友评论