Mathematical Morphology in ImageJ

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Mathematical Morphology in ImageJ

Isaac Perez
Greetings.

Recently install ImageJ on my computer and am learning to use it. My
interest is to know and learn to use the features of mathematical
morphology in ImageJ (Whether incorporated or
provided functionality through plugins).

I downloaded I installed the following plugins:

 - Grayscale morphology (down from
http://rsbweb.nih.gov/ij/plugins/gray-morphology.html)

 - Fast Morphology (down from
http://imagejdocu.tudor.lu/doku.php?id=plugin:morphology:fast_morphological_filters:start)

I have tested on several images. I have also tested the mathematical
morphology features built into ImageJ (available from the menus
"Process-> Binary-> Erode"
"Process-> Filters-> Maximun", etc).

Currently, I am creating a small application that allows you to upload
an image, apply it several mathematical morphology operators (erosion,
dilation, opening, etc.) and
configure the parameters associated with each operation that applies
(size, shape and anchor point of the structuring element, and number
of iterations). All this as a homework project
of the University. In developing the tool I'm using the OpenCV library.

Well, I install ImageJ in order to compare my results with ImageJ.
However, I've noticed that my results are not exactly equal to those
produced
by various mathematical morphology tools of ImageJ. I'm using the
OpenCV library functions ('cv::erode()', 'cv::dilate',
'cv::morphologyEx()', etc.)

My specific question is: Is it normal that the results obtained with
ImageJ are different from the results obtained using the OpenCV
library functions, or am I doing something wrong?.

Another issue is that I have no clear exactly which parameters using
the ImageJ functionalities to implement morphological operations. Let
me explain:

  (1) "Process-> Binary-> Erode" and "Process-> Binary-> Dilate":

        What is the size, the shape and the anchor point of the structuring
element used?


  (2) "Process-> Filters-> Maximun" and "Process-> Filters-> Minimun":

        Does the structuring element exactly as shown in the window that
appears when you click on "Process-> Filters-> Show Circular
Masks..."?
        (Ie a binary frame of 150 * 150 pixels with a circle of given
diameter in the middle)


  (3) "Plugins-> Morphology-> Gray Morphology":

        When the structuring element is not a circle, how it interprets the
radio?, For example, as would be a 'square' radius 3 (will be a 7*7
square?!).

        When you check the box "Show Mask", do not understand that there are
three windows. Do not understand how is the structuring element.


  (4) In "Plugins-> Morphology-Morphological Filters Fast":

        Does the structuring element exactly as shown in the window that
appears when you check "Show Element"?
        (Ie, the structuring element order plus 10 pixel frame around).


Because of these questions, do not know if there is a fault in my
program (or in the OpenCV library functions) or if I'm wrong setting
my program and so the results I get are
different from those produced by ImageJ.


Thanks in advance for any help and/or suggestions.

--
Isaac Perez

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Mathematical Morphology in ImageJ

Isaac Perez
Greetings.

Recently install ImageJ on my computer and am learning to use it. My
interest is to know and learn to use the features of mathematical
morphology in ImageJ (Whether incorporated or
provided functionality through plugins).

I downloaded I installed the following plugins:

 - Grayscale morphology (down from
http://rsbweb.nih.gov/ij/plugins/gray-morphology.html)

 - Fast Morphology (down from
http://imagejdocu.tudor.lu/doku.php?id=plugin:morphology:fast_morphological_filters:start)

I have tested on several images. I have also tested the mathematical
morphology features built into ImageJ (available from the menus
"Process-> Binary-> Erode"
"Process-> Filters-> Maximun", etc).

Currently, I am creating a small application that allows you to upload
an image, apply it several mathematical morphology operators (erosion,
dilation, opening, etc.) and
configure the parameters associated with each operation that applies
(size, shape and anchor point of the structuring element, and number
of iterations). All this as a homework project
of the University. In developing the tool I'm using the OpenCV library.

Well, I install ImageJ in order to compare my results with ImageJ.
However, I've noticed that my results are not exactly equal to those
produced
by various mathematical morphology tools of ImageJ. I'm using the
OpenCV library functions ('cv::erode()', 'cv::dilate',
'cv::morphologyEx()', etc.)

My specific question is: Is it normal that the results obtained with
ImageJ are different from the results obtained using the OpenCV
library functions, or am I doing something wrong?.

Another issue is that I have no clear exactly which parameters using
the ImageJ functionalities to implement morphological operations. Let
me explain:

  (1) "Process-> Binary-> Erode" and "Process-> Binary-> Dilate":

        What is the size, the shape and the anchor point of the structuring
element used?


  (2) "Process-> Filters-> Maximun" and "Process-> Filters-> Minimun":

        Does the structuring element exactly as shown in the window that
appears when you click on "Process-> Filters-> Show Circular
Masks..."?
        (Ie a binary frame of 150 * 150 pixels with a circle of given
diameter in the middle)


  (3) "Plugins-> Morphology-> Gray Morphology":

        When the structuring element is not a circle, how it interprets the
radio?, For example, as would be a 'square' radius 3 (will be a 7*7
square?!).

        When you check the box "Show Mask", do not understand that there are
three windows. Do not understand how is the structuring element.


  (4) In "Plugins-> Morphology-Morphological Filters Fast":

        Does the structuring element exactly as shown in the window that
appears when you check "Show Element"?
        (Ie, the structuring element order plus 10 pixel frame around).


Because of these questions, do not know if there is a fault in my
program (or in the OpenCV library functions) or if I'm wrong setting
my program and so the results I get are
different from those produced by ImageJ.


Thanks in advance for any help and/or suggestions.




--
Isaac Perez

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Mathematical Morphology in ImageJ

Gabriel Landini
On Saturday 15 Jun 2013 05:17:34 Isaac Perez wrote:
> I have tested on several images. I have also tested the mathematical
> morphology features built into ImageJ (available from the menus
> "Process-> Binary-> Erode"
> "Process-> Filters-> Maximun", etc).

Hi Isaac, It is difficult to understand what is exactly the problem.
The built in binary erode, dilate open and close are all 3x3 kernels.

If you use the built in Min and Max filters for erode and dilate, those use
circular masks, (radius 1 is a square and 0.5 is a cross). Since I have no
idea what OpenCV does I can't say if that is the problem.

You can simulate larger mask with more iterations of the 3x3 kernels, But
because the shapes are different to circular ones, obviously the results will
be slightly different. This is a well known issue and in general people
describe what kernel shapes and sizes they use.

For other plugins, you should ask the authors of the plugins or look into the
source code.

For testing purposes I would create a set of small binary regions and process
them with all you algorithms to see what the difference really is. (for
instance averaging the original and the result will show you which pixels are
changed by the operation).

Regards

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html