Loading images probably the most frequently operation we do with OpenCV. The complete listing is shown in Listing 1 below. It loads an image and display it in a nice window.
Listing 1: loadimg.c
Remember to always include cv.h in your OpenCV programs. The listing above also included highgui.h to use OpenCV GUI functions for displaying the image.
To compile the code, type the lines below from your command line:
gcc loadimg.c -o loadimg
-I"C:\OpenCV\cv\include"
-I"C:\OpenCV\cxcore\include"
-I"C:\OpenCV\otherlibs\highgui"
-L"C:\OpenCV\lib" -lcxcore -lcv -lhighgui
Replace C:\OpenCV with your OpenCV base directory. To simplify the compilation, setup your text editor for the commands above or use Makefile. Run the program with:
loadimg rahma_sarita.jpg
It will load rahma_sarita.jpg and display it in a nice window shown below.

| 1. Introduction | 3. Retrieve Image Properties |
| ICQ | 489571630 |
| Skype | dede_bl4ckheart |
| Yahoo | dede_bl4ckheart |
| nashruddin.amin |