rt, 本程序用调用了opencv裁剪图片, 其实本质上就是鼠标操作。
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/opencv.hpp"
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
// global variable
static Mat g_img_src;
static Mat g_img_src_res;
static Mat g_img_dst;
static Mat g_img_sub;
static bool g_is_rect_inited = false;
static Point g_rect_tl;
static string g_window_name = "image";
static int imagenum = 13;
string sourcefolder = "sele" ;
string resfolder = "re";
static void onMouse( int event, int x, int y, int, void* )
{
if(CV_EVENT_LBUTTONDOWN == event){
g_is_rect_inited = true;
g_rect_tl = Point(x, y);
}
else if (CV_EVENT_MOUSEMOVE == event && g_is_rect_inited){
g_img_src.copyTo(g_img_dst);
rectangle(g_img_dst, g_rect_