Created
April 30, 2015 06:50
-
-
Save krishnan793/bb9c7048137a25aa49a1 to your computer and use it in GitHub Desktop.
Program reads a picture file called boy.jpg in the current folder and displays it. After 1 second it will change to grey scale.
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<highgui.h> | |
#include<cv.h> | |
using namespace cv; | |
int main() | |
{ | |
Mat A,B; | |
A=imread("boy.jpg"); //Read the image file | |
namedWindow("Boy", CV_WINDOW_AUTOSIZE ); //Create a new window to show the image. Name the window as "boy" | |
cvtColor(A,B,CV_BGR2GRAY); //To convert bgr (blue green red) to greyscale and store it in B | |
imshow("Boy",A); //Display it in the window named Boy | |
cvWaitKey(1000); //Delay of 1 second | |
imshow("Boy",B); //Display Second Image | |
cvWaitKey(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment