![]() |
University of Murcia, Spain ![]() |
Starting guideFramework setupThis guide is intended to help in the installation and configuration of the QVision on a new system. It also includes instructions to get a first "hands-on", not so simple "kind-of-hello-world" QVision sample application running.Dependencies of the QVisionRight now, QVision needs the following libraries and programs to be installed. The framework will be a modular library in a future, so you will be able to compile the core features without unneeded functionality:
Setting up Ubuntu systemsIf you are planning to install QVision on a Ubuntu, Debian or any other distribution with a package management system based on apt-get, synaptic, or adept, you can directly install the following packages:
Compilation and Install.Latest release and older versions can be downloaded from the following url:http://forja.rediris.es/frs/?group_id=321 Once you have the tar file for QVision, named QVision.<version>.tgz, copy it to your home directory (or a temporary location for compiling), and untar-it using this line:
# tar xzvf QVision.<version>.tgz Then you should rename or copy the file config.pri.example inside the QVision directory to config.pri. This file contains several configuration variables which can be modified to tune the compilation and installation of the library. You can read the text information included in the own config.pri file about them. Once customized the config.pri file to your needs and system, compile the library using the following commands inside the QVision directory:
# qmake # make This will compile the library. When compilation is done, you should install it in your system. This will copy some files in the directory specified in the variable 'INSTALL_PATH'. If that route is in your home directory, or other place you have permissions to write, you should simply do the following:
# make install Otherwise, you should use sudo console command, to copy the files as a super-user:
# sudo make install If you need to uninstall the library, simply compile again, and use the following line:
# sudo make uninstall This will erase QVision's library files from the directory where you installed it previously. First application under the QVisionQVision projectsQVision applications are created inside Qt projects, which are specified by Qt project file. These files contain configuration information to compile the C++ sources of the application under the Qt, and in our QVision applications, also to link with the QVision library.The following is the content of an example Qt project file to create a QVision application from a single C++ source file named example.cpp:
include(/usr/local/QVision/qvproject.pri) TARGET = example SOURCES = example.cpp The include directive is used to load the configuration contained in other project files. Every QVision project should include the file qvproject.pri, located in the QVision installation directory, which contains the proper configuration to compile QVision applications. The route to the qvproject.pri file must be modified, according to the installation directory of the library. The TARGET variable must be set to the name of the target executable file for the application. The SOURCES variable must contain a list of the names of the source files in the project. In our example, the project will have only one file, named example.cpp. The first programWe can store the previous project file with the name example.pro and the example.cpp source file in the same directory. The latter source file will contain the following code:
#include <iostream> #include <qvio.h> #include <qvipp.h> int main(int argc, char *argv[]) { // Check if the user provided enough command line parameters. if (argc < 3) { std::cout << "Usage: " << argv[0] << " <input image> <output image>" << std::endl; return -1; } // Input and output images QVImage<uChar, 3> inputImage, outputImage; // Read the input image readQVImageFromFile(argv[1], inputImage); // Apply Gauss filter FilterGauss(inputImage, outputImage); // Write output image writeQVImageToFile(argv[2], outputImage); } The application applies a Gaussian filter on the contents of the image file specified in the first command line parameter, and stores the resulting image in the file specified in the second command line parameter. Compiling and executing the programOnce the files example.cpp and example.pro are created in the same directory, you can compile the application using the qmake and the make tools:
# qmake # make This should create the binary executable example. You can execute the application using a command line like the following:
# ./example lena.png lena-gauss.png
Assuming that an image file named lena.png exists, and contains the following image:
![]() The application creates a new image named lena-gauss.png as indicated by the second command line paramenter, storing the following image:
![]() |