Skip to content

Instantly share code, notes, and snippets.

@atinfinity
Created November 26, 2013 14:06
Show Gist options
  • Save atinfinity/7658792 to your computer and use it in GitHub Desktop.
Save atinfinity/7658792 to your computer and use it in GitHub Desktop.
UMatのサンプルプログラム
#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