Reading and showing images using opencv

30 Apr 2015
Here is a sample code to read and show an image after converting it into grey scale.
Program reads a picture file called boy.jpg in the current folder and displays it. After 1 second it will change to grey scale.

Use this command to compile the program.

g++ first.cpp `pkg-config --cflags opencv` `pkg-config --libs opencv`

where first.cpp is the file name.