Wednesday, 12 November 2014

Tutorial eCognition : Finding area of classified objects within eCognition

Problem:

I have done some classification with many classes. Now i want to know the area of individual class. Please tell a way to find it and store in a text file. 

Solution

For this kind of problem, many people would resort to finding a way in ArcGIS with exported shapes files with classification. In ArcGIS, one has to do series of operations to get the desired output (add area column and populate with area for every features, sum up area for each class). These operation are not complex but if you are not good with ArcGIS, then doing all that is a tough nut to crack.

Good thing is that there is feature in eCognition ‘area of classified objects’ that can be used for this purpose. But for that you have to create that feature for every class that you have in your project. Imagine you have more than 10 classes. Creating that features for ten different classes is boring, isn’t it? At least for me, it is cumbersome. On top of that imagine you just finished with the project you are working with and you have to perform same thing again in another project with 15 classes with different names. Gosh, you have to create another 15 features again. Not fun, right? So what’s the solution? You guess it right, we can use array functionality within eCognition to loop over all classes and create that feature for every class in one go. The rule set,we will create, will work in every project regardless of numbers of classes you have in your project. Sounds interesting? Keep on reading.

eCognition introduce concept of variables and array from version 8 ( ? not sure). With array functionality, you can gather all classes present in  you project in one go and make a particular feature with each class. I have seen many eCognition projects developed by other people for last three years and not many people use these new features of eCognition. It very handy for many cases. So here is a rule that that does the following. You can even create a customized algorithm from it and apply it to every project at the end of your classification.
  1.  create an array to store all you classes
  2.  create a temp class
  3. create a feature area of classified objects ( you can specify unit you want) based on temp class
  4.  loop each class from step 1 and store class into temp class. Get information about area from feature in step three and store in an array.
  5.  write class array and area array in a CSV with export project statistics
Area of classified objects for each class in a csv file.

Rule set in action

Loop over all classes one at a time

Store areas of current class in an array
export area information store in the array in a csv file

I have written another use of array functionality to  export a particular feature fore every image bands in your project in this blog


No comments:

Post a Comment