HI 5323 Session 4

Overview:

  1. Lecture 1: Using C++ and Qt in Practice (PDF file)
  2. Lecture 2: Image Operations Pt. 2 (PDF file)
  3. Reading Assignment


Resources and Assignments:


1. Lecture 1: Using C++ and Qt in Practice

Qt Installation

The free Windows version of Qt 4.0.1 can be downloaded here. When you install the software be careful to use the default installation directory (no spaces in pathname!) and click "yes" when asked about installing the necessary environment variables. Please also let the Qt installation routine automatically download and install the MinGW compiler.
Now check if the environment variables were updated correctly by the installation program:

  1. Go to Start -> Run and enter "regedit".
  2. Open the "HKEY_CURRENT_USER" subtree.
  3. Click on "Environment". In the right panel of the dialog you should now see a list of entries, one says "PATH".
  4. Double-click on "PATH" - a text entry dialog pops up. Please make sure that it contains the following information:
    C:\Qt\4.0.1\bin;C:\MinGW\bin
In a last step one has to agree to the license, which has to be done on in a command-line shell:
  1. Go to Start -> Run and enter "cmd" in the command prompt to open a shell.
  2. Change into the Qt directory:
    cd \Qt\4.0.1
  3. Start the configure program
    configure -platform win32-g++ -release
  4. Agree to the license and then wait for qmake to compile (may take a couple of minutes).

Example Files

We have tested the installation and compatibility of Qt under MS Windows XP. The example files (mentioned in class) are available here. In the following we summarize the series of commands necessary to compile the example.

  1. Go to Start -> Run and enter "cmd" in the command prompt to open a shell. You are now in a command-line shell. Many commands are similar to UNIX: copy , cd , mkdir , rmdir , more , etc., so you can navigate similar to a UNIX shell. However, to list directory contents, you need to use "dir" instead of "ls". Of course you can use Windows Explorer to navigate the files in your directory. Place the example files onto your drive, unzip them,  and "cd" to the directory.
  2. Use Qt Designer as shown in class to create a file "editor.ui". You can also write the C++ source of the "editor" directly. If you do have a .ui designer file, you can use it to create the C++ code in the following steps.
  3. Create C++ code of designer file: At the command prompt enter
    uic editor.ui -o ui_editor.h (creates header file)
  4. Next, we need to create the project file that is later being used to create the Makefile for the compiler. The Makefile-generator can create automatically a project file by inspecting your source directory. All the found cpp and ui files are automatically included into the project:
            qmake -project
  5. Now create the actual Makefile: 
  6. qmake qt_examples.pro
  7. Write the main program with an editor of your choice (main.cpp)
  8. Finally, to compile and link object files, enter
    make
  9. You can clean up all object files and the executable (release\qt_examples.exe) by entering
    make clean
  10. More programs and step-by-step tutorials are in the Qt documentation (accessible from Windows: Start-> Programs)

Image Histogram Example

You can download here the zipped example program folder including documentation (MS Word document) and the birds.jpg input image used in the lecture notes. Please read both the lecture notes above and the documentation as there is distinct information in either of them, e.g. the lecture notes explain the files in more detail, whereas the MS Word file describes the compilation.

3. Reading Assignment:

Kenneth R. Castleman, Digital Image Processing, Chapter 8,9
John C. Russ, The Image Processing Handbook, Chapter 5