opencv 剪切图片
Posted zfq572815535
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了opencv 剪切图片相关的知识,希望对你有一定的参考价值。
#include "pch.h"
#include <iostream>
#include <highgui.hpp>
#include <highgui/highgui_c.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
//#include <opencv2/core/core.hpp>
//#include <opencv2/highgui/highgui.hpp>
//#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
//const char* path = "C:\Users\fengl\Desktop\素材.avi";
const char* path = "C:\Users\fengl\Desktop\p1.jpg";
int main()
{
cv::Mat tomato = cv::imread(path, 1);
Rect rec(tomato.cols / 4, tomato.rows / 4, tomato.cols / 2, tomato.cols / 2);
Mat img = tomato(rec);
cv::imshow("test", tomato);
cv::waitKey(1000);
cv::imshow("test", img);
cv::waitKey(1000);
return 0;
}
以上是关于opencv 剪切图片的主要内容,如果未能解决你的问题,请参考以下文章