Hello, I'm using opencv2.7 and i tried to take a colored image convert it into gray scale and store it..But when i execute it says:
editimg.c: In function ‘main’: editimg.c:10:2: error: unknown type name ‘Mat’ editimg.c:13:25: error: request for member ‘data’ in something not a structure or union editimg.c:15:4: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default] editimg.c:19:2: error: unknown type name ‘Mat’
And here is my code:
include <cv.h>
include <highgui.h>
int main( int argc, char* argv ) { char imageName = argv[1];
Mat image; image = imread( imageName, 1 );
if( argc != 2 || !image.data ) { printf( " No image data \n " ); return -1; }
Mat gray_image; cvtColor( image, gray_image, CV_BGR2GRAY );
imwrite( "/home/sumukha/sumukha/opencvsamples/Gray_Image.jpg", 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; }