Page 6 out of 26 total pages


Integrating the QBIC API Into Your Application


This chapter contains the following regarding the integration of the QBIC API into your applications:

QBIC API Levels of Complexity

When you integrate the QBIC API with your application, you can choose between the following levels of complexity:

Sample Programs

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

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

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

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

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.

Deriving Your Own Feature Extraction and Matching Classes

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:

  1. Subclass QbFeatureClass with your new feature class.

    Important! The substring formed by the first six characters after a leading "Qb" (if present) must be unique among all feature classes. This prevents file naming problems in the catalog, which uses the 8.3 file naming convention. (File name is eight characters long; file extension is three characters long)

  2. Implement the required virtual functions, as they apply to the feature.
  3. Add the appropriate clause to QbCreateFeature in QbCreate.cpp.
  4. Recompile QbCreate.cpp and the new class.
  5. Relink the QBIC API library and the main programs, including QbMkDbs and QbQBE. A sample makefile for supported platforms is provided in the qbic/QbicApi subdirectory.



Page 6 out of 26 total pages


xzhu@almaden.ibm.com or tedl@almaden.ibm.com
Copyright © 1998, IBM Corporation. All rights reserved.