This chapter contains the following regarding the integration of the QBIC API into your applications:
When you integrate the QBIC API with your application, you can choose between the following levels of complexity:
Integrating the higher-level QBIC functionality is simple and straightforward, and you should use this approach whenever possible. The only drawback of this approach is that you have to use QBIC's default database implementation (dbm) to manage content.
If you want to use your own DBM system to store QBIC feature data, you must use the lower-level QBIC API. A set of sample programs, described in the following section, will help to get you started.
QBIC includes a collection of sample programs with source code that demonstrate how to incorporate QBIC functionality into your applications. The executables for more complete programs, including QbMkDbs and QbQBE, QbMkThmb, and QbDumpDb are in the qbic/bin
subdirectory. These programs are close to what you would need in a real application. Program descriptions and instructions on how to use them are given in "Running QBIC Demo Programs" on page 21.
The source code for these programs is located in the qbic/QbicApi
subdirectory. You will notice after reading the source code that each of these programs simply creates a QbicWrapClass object inside the program, and then invokes the object's method such as QbicWrapDBS, QbicWrapQBE, QbicWrapThm, and QbicWrapDumpDb for the needed functionality.
A set of programs using the lower-level QBIC API is also included. Each of these programs is designed with limited functionality for the sake of simplicity. They are located in qbic/QbicApi/examples
subdirectory. Get familiar with these low-level sample programs before reading the high-level implementation, like QbicWrapClass:
QbGetImage.cpp demonstrates how to encapsulate image data for feature extraction using the QbGenericImageDataClass, which is derived from QbGenericDataClass.
This program reads an input image and prints image information, including size and RGB value at a specified pixel position.
QbGenericImageDataClass has its own color quantization routine that reduces the number of image colors based on QBIC's own color palette. |
QbImgDis.cpp demonstrates how to compute the distance between two input images using the QbColorHistogramFeatureClass feature. The program shows how to use QbFeatureClass to compute image feature data.
This program creates QbColorHistogramFeatureClass objects, reads the image, and extracts feature data based on input image data. Once the feature data for two images has been extracted, the image distance is computed.
QbKeyDis.cpp demonstrates how to compute the distance between two input keys using the QbColorHistogramFeatureClass feature. In this example (as compared to the previous one), the image features have already been computed and are stored in a database.
This program retrieves the feature data for distance computation by connecting to a database. It also shows how to use the QbGenericImageDataClass to store computed feature data and raw image data.
QbKeyIte.cpp demonstrates how to use the QbDbIteratorClass to compute the first 10 image key distances from the query key.
The results are not ordered based on the distance from the query image. To do that, you must use the QbKeyDatabaseClass. |
This program also shows how to use the QBIC error handling routine to print any error messages generated by the API.
To help you derive your own feature extraction classes, we provide a sample class QbExampl.hpp
and QbExampl.cpp
located in the qbic/QbicApi
directory. These modules implement a skeleton class derived from QbFeatureClass. It is recommended that you read the extensive comments included in the module code.
In general, writing and including an additional feature class involves the following steps:
QbCreate.cpp
.
QbCreate.cpp
and the new class.
qbic/QbicApi
subdirectory.