码迷,mamicode.com
首页 > 其他好文 > 详细

opencv 剪切图片

时间:2018-11-28 22:23:58      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:desktop   top   wait   key   show   pat   enc   opencv   char*   

#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 剪切图片

标签:desktop   top   wait   key   show   pat   enc   opencv   char*   

原文地址:https://www.cnblogs.com/zfq572815535/p/10034461.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!