Skip to content

Instantly share code, notes, and snippets.

@cosmo0920
Created September 26, 2012 17:14
Show Gist options
  • Save cosmo0920/3789276 to your computer and use it in GitHub Desktop.
Save cosmo0920/3789276 to your computer and use it in GitHub Desktop.
OpenCV2.3での白黒変換
#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace cv;
int main(int argc, char** argv)
{
const char *imagename = argc > 1 ? argv[1] : "../image/hoge.png";
Mat src_img = imread(imagename);
if(!src_img.data)
return -1;
Mat gray_img;
cvtColor(src_img,gray_img, CV_BGR2GRAY);
imwrite("gray.png",gray_img);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment