Project

General

Profile

Actions

Morph-M Python - Structuring Element

Introduction

Structuring elements are the most elementary objects that make it possible to parametrize Morphological operations. Some structuring elements have been predefined, that you can manipulate through their interfaces.

And to create your own, you can use usefull factories.

Neighborhood construction

Hereafter, a little example to construct rectangle structuring element (centered):

def constructRectangeNeighborhood(xSize,ySize):
    list=[];
    for i in range(xSize):
      for j in range(ySize):
          list.append(i-xSize/2)
          list.append(j-ySize/2)
    return NeighborListFactory(ConnexityType.Square, 2,list)

sq9x15 = constructRectangeNeighborhood(9,15)
ImErode(imIn,sq9x15,imOut)

This sample code could be easily extended to other shapes/dimensions.

Documentation

Updated by Serge Koudoro almost 15 years ago ยท 2 revisions