opencv进行图像复原

#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <math.h>#include <string.h>#include <opencv/cv.h>#include <stdio.h>#include "opencv2/photo/photo.hpp" using namespace cv; int pic_info[4];char pic_name[20];Mat mat1, imageROI, dst; int width, height;IplImage src, roi, dstI; void on_mouse( int event, int x, int y, int flags, void* ustc){if(event == CV_EVENT_LBUTTONDOWN){pic_info[0] = x; /*width1*/pic_info[1] = y; /*height1*/pic_info[2] = 0; /*width2*/pic_info[3] = 0; /*height2*/}if(flags == CV_EVENT_FLAG_LBUTTON){pic_info[2] = x;pic_info[3] = y;cvZero(&roi);cvZero(&dstI);rectangle(imageROI, cvPoint(pic_info[0], pic_info[1]),cvPoint(pic_info[2], pic_info[3]),cvScalar(255,255,255), -1);inpaint(mat1, imageROI, dst, 1, CV_INPAINT_TELEA);imshow("2", imageROI);imshow("3", dst);}} int main(int agrc, char *argv[]){memcpy(pic_name,argv[1], sizeof(argv[1]));mat1 = cv::imread(argv[1]);src = mat1;width = mat1.rows;height = mat1.cols; imageROI = cv::Mat(width, height,CV_8UC1,cv::Scalar(0, 0, 0));dst = cv::Mat(width, height,CV_8UC3,cv::Scalar(0, 0, 0));roi = imageROI;dstI = dst; imshow("1", mat1);cvSetMouseCallback("1", on_mouse, NULL); cv::waitKey(0);return 0;}

,在向山靠近一点,才发现这座山,好象一位诗人遥望远方,

opencv进行图像复原

相关文章:

你感兴趣的文章:

标签云: