Created
September 26, 2012 17:14
-
-
Save cosmo0920/3789276 to your computer and use it in GitHub Desktop.
OpenCV2.3での白黒変換
This file contains hidden or 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 <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