Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cv.h>
- #include <highgui.h>
- using namespace cv;
- int
- main( int argc, char** argv )
- {
- char* imageName = argv[1];
- Mat image;
- image = imread( imageName, 1 );
- if( argc != 3 || !image.data )
- {
- printf( " No image data \n " );
- return -1;
- }
- Mat gray_image;
- cvtColor( image, gray_image, CV_RGB2GRAY );
- imwrite( argv[2], gray_image );
- namedWindow( imageName, CV_WINDOW_AUTOSIZE );
- namedWindow( "Gray image", CV_WINDOW_AUTOSIZE );
- imshow( imageName, image );
- imshow( "Gray image", gray_image );
- waitKey(0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment