mercoledì 12 dicembre 2012

Function strel for Octave

(tested on Octave 3.6.3)
version 0.5.1 available

Introduction
If you're looking for a "strel" function for Octave, you're in the right place.
If you, instead, do not know what a morphological structuring element for image processing is, you probably don't want to read further more.
Structuring elements are logical 2-dimensional matrixes, which are used in image processing operations including, but not limiting to dilation, erosion, opening, closing.
Although some people think you can easily build any structuring element you would ever imagine, and it's true, however if you just need to run an existing MATLAB® file, script or function, you might be miffed by substutution of all occurrences of strel by yourself, with the related structuring element it returns.



Download (current)
Since I've begun to contribute OctaveForge developing strel, many improvements has been made and thanks to Carnë Draug (maintainer of image package in Octave), strel is now included in the official package and it is available here for download.




Download (obsolete)
To download this function, press the following link: strel.m (0.5.1)
I want to point out that this post is not about "how to use additional octave function files", but just about strel.
The file is covered by GPLv3 license, and at the moment you download the file, it is supposed you have read and accepted it.
Before downloading, read it surfing here (GPL licenses).



Examples
Here some examples of output of strel with different parameters.

>>> strel('diamond', 3)
ans =

   0   0   0   1   0   0   0
   0   0   1   1   1   0   0
   0   1   1   1   1   1   0
   1   1   1   1   1   1   1
   0   1   1   1   1   1   0
   0   0   1   1   1   0   0
   0   0   0   1   0   0   0


>>> strel('pair', [3 2])
ans =

   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   0
   0   0   1   0   0
   0   0   0   0   0
   0   0   0   0   0
   0   0   0   0   1


>>> strel('rectangle', [3 2])
ans =

   1   1
   1   1
   1   1


>>> strel('square', 3)
ans =

   1   1   1
   1   1   1
   1   1   1


>>> strel('disk', 3)
ans =

   0   0   0   1   0   0   0
   0   1   1   1   1   1   0
   0   1   1   1   1   1   0
   1   1   1   1   1   1   1
   0   1   1   1   1   1   0
   0   1   1   1   1   1   0
   0   0   0   1   0   0   0




MATLAB® is a registered trademark of MathWorks®

Nessun commento:

Posta un commento