HALCON helps speed up image classification

Classification is a very important method often used in image processing. It can be utilised for directly segmenting an image into known classes, i.e. pixels are classified and grouped into regions, which can then be processed further. Ideally used for texture segmentation and colour classification.

For such tasks, HALCON provides a method to significantly speed up your classification. You may already know this method from colour transformation, or heard its name in connection with visualisation: The look-up table, or “LUT” for short.

For all image classifiers in HALCON, i.e., GMM, KNN, MLP, or SVM, the LUT functionality is available. To use it, create_class_lut_* has to be called after training a classifier with create_class_* and train_class_*. Then, use classify_image_class_lut instead of classify_image_class_*.

Now, every possible response of the classifier is stored in a LUT and calculating the class of every image point online is no longer necessary. Creating a LUT can be done offline. Hence, you benefit from faster processing during online inspection. However, a significant speedup sometimes comes at a price: When using a LUT, the accuracy of the classification results may be lower than when classifying from scratch.

ImageClassificationHALCON

The LUT can only be 3-dimensional at most. Therefore, NumComponents in operators create_class_* can have a maximum value of 3. That means, you can use up to 3 channels in the input image, or restrict the number of components to 3 by setting Preprocessing to appropriate values.

The HDevelop standard example classify_image_class_lut.hdev demonstrates the usage of a LUT for classifiers available in HALCON. The sample also shows the impact on runtime when using a LUT. You can find the example in:

%HALCONEXAMPLES%hdevelopSegmentationClassification

Learn more about MVTec’s HALCON 12