Created
November 26, 2013 14:06
-
-
Save atinfinity/7658792 to your computer and use it in GitHub Desktop.
UMatのサンプルプログラム
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <opencv2/core/core.hpp> | |
#include <opencv2/imgproc/imgproc.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#ifndef _DEBUG | |
#pragma comment(lib,"opencv_core300.lib") | |
#pragma comment(lib,"opencv_imgproc300.lib") | |
#pragma comment(lib,"opencv_highgui300.lib") | |
#else | |
#pragma comment(lib,"opencv_core300d.lib") | |
#pragma comment(lib,"opencv_imgproc300d.lib") | |
#pragma comment(lib,"opencv_highgui300d.lib") | |
#endif | |
using namespace std; | |
using namespace cv; | |
int main(int argc, const char * argv[]) | |
{ | |
Mat img = imread("lena.jpg", IMREAD_UNCHANGED); | |
UMat uimg = img.getUMat(ACCESS_READ), ugray; | |
cvtColor(uimg, ugray, COLOR_BGR2GRAY); | |
namedWindow("UMat"); | |
imshow("UMat", ugray); | |
waitKey(0); | |
destroyAllWindows(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment