标签:
char *bgFile = "C:/C_Project/HandTraining/Debug/res/bg.jpg"; FILE *file = fopen(bgFile, "r"); if (file == NULL){ cout << "bg.jpg文件不存在..." << endl; return -1; } char *handFile = "C:/C_Project/HandTraining/Debug/res/hand002.png"; file = fopen(handFile, "r"); if (file == NULL){ cout << "hand0001.png文件不存在..." << endl; return -1; } Mat image = imread(bgFile); Mat hand = imread(handFile); Mat mask = imread(handFile,0); Mat imageROI = image(Rect(30, 120, hand.cols, hand.rows)); hand.copyTo(imageROI,mask); //addWeighted(imageROI, 1.0, hand, 0.3, 0, imageROI); cv::imwrite("C:/C_Project/HandTraining/Debug/res/result.jpg", image); imshow("result", image); waitKey(); cv::destroyAllWindows();
标签:
原文地址:http://www.cnblogs.com/mypsq/p/5845216.html