Skip to main content

Posts

Featured

Program in C++ to Read and display an Image

This Program will Read an image from a folder and displays it to the user. You can use this program as it is for yourself, the code is tested  and working fine // Read_Display  image.cpp  : Defines the entry point for the console application. // #include  “stdafx.h” #include  “opencv2/highgui/ highgui.hpp ” #include  <iostream> using namespace  cv; using namespace  std; int  main() { // Mat  img = imread(“ //Here write the link of your image e.g F:/Profile/German/GTSDB/20/ image.ppm “, CV_LOAD_IMAGE_UNCHANGED); //read the image data in the file “ MyPic.JPG ” and store it in ‘img’ if  ( img.empty ()) //check whether the image is loaded or not { cout << “ Error : Image cannot be loaded..!! ” << endl; //system(“pause”); //wait for a key press return  -1; } namedWindow(“ MyWindow “, CV_WINDOW_AUTOSIZE); //create a window with the name “MyWindow” imshow(“ MyWindow “, img); //display the image which is stored in the ‘img’ in the “MyWindow” window waitKey(0)

Latest posts

First Program in OpenCV C++ in Visual studio

How to Configure OpenCV with MS Visual Studio

Prerequisites of Image Processing Projects (OpenCV)

What is OpenCV ?