Friday, 7 June 2013

eConition Tutorial: Customized algorithm for performing majority vote in eCognition

Today, I present you a customized rule set which lets you to assign super-object by evaluating all of its sub-objects based on which classification makes up the largest proportion of the area. This is one of the wishlist in eCognition Ideas and was also frequently asked in the ecognition community.

A majority statistic customized algorithm lets you assign  super- object to the class with the majority value of the pixels within each object. This would be useful for converting existing pixel-based classifications into an object-based format where additional object-based edits can be made.

The only parameter in this customized algorithm is a level variable. This is a level which consists of super-object. The customized algorithm will look one level below the level variable and perform all the necessary calculation.

Sub-objects level with classification

Super-objects level with no classification

Super-object level with classification from customized algorithm
The customized algorithm does assignment of super-object with following steps.

1) store all the classes in an array ( array_class)
3) loop through your objects in super objects
2) loop through your class arrays
4) store rel. area of (1) in an array for the class ( array_occur)
5) find maximum in the array_occur
6) assign super-object as maximum occurrence class in array  array_occur.

All of these steps are performed behind the scene in customized algorithm, so the user does not need to worry about how to perform these steps.

I have uploaded a zip file where you will find a project which shows the usage of the customized algorithm. There is a  customized rule-set as well. Load the customized rule set in your project and after that you will find a algorithm MajorityVote in the available algorithm list.

The algorithm was developed with eCogntion 8.8 and  will not work below that version.


  1. Hi,

    eCognition_logo.jpg is missing

    ruleset does not load

  2. Same here, tried it with 8.8 and 8.9

  3. hi Gerorge and Vijay

    It seems you are right, eCognition_logo is missing and i tried to search in my computer but couldnot find. But you can try the ruleset in any other image you have.
    1) load your image
    2) do chess board segmentation of small size and assign some classes to some pixels
    3) create level at higher level with bigger size with no classification
    4) load the rule ( it is encrypted, i have double checked and it loads correctly)
    5) once you loaded the ruleset, rightclick in the process tree, append new and under algorithm you will find MajorityVote algorithm.
    6) the ruleset has one parameter: level which is the lvl with bigger scale or size.

    Hope that helps.