Soln 1:
#include "stdafx.h"
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <opencv/cv.h>
using namespace cv;
using namespace std;
int main()
{
//Read Color Image
Mat im_rgb = imread("C:/Users/kvemishe/Documents/Vision/images/kitten.jpg");
//waitKey is important for image display; 0 means wait forever
imshow("Kitten",im_rgb);
waitKey(0);
//Convert Color to GrayScale
Mat img_grey;
cvtColor(im_rgb,img_grey,CV_BGR2GRAY);
//Write Greyscale to file location
imwrite("C:/Users/kvemishe/Documents/Vision/images/kittengrey.jpg",img_grey);
}
No comments:
Post a Comment