1. Study of the dilation operator
Understand the morphological operator that performs dilation. The code is provided in the method dilate(), only the structuring element "Unknown" is coded.
Apply the dilation operator on pattern and impulse with the structuring element "Unknown" using the plugin Dilate. Give the structuring element "Unknown 9" of size 9 and the resulting image. Fill the report.
Important note: To make the connection with the course notes, we are in the special case of graylevel morphology with b[y] = 0 and we are drawing Ωb. we only consider symmetric structuring element b = bs.
2. Structuring element
Here, we propose to implement three different shapes for the structuring element of size NxN where N is odd, 0 < N < half size of the input image. The three shapes with different size are shown at the figure on the right.
Code the method createStructuringElement(Shape shape, int size) that returns a 2D boolean array containing the structuring element for a specified shape and a specified size.
Give the results of dilation operator on bar with the structuring element Square 7, Cross 3, and Disk 9. Insert the resulting images in the report.
3. Morphological operators
We propose to implement a series of morphological operators with the three structuring elements defined in Question 2.
|Operator||Operation||Method in Code.java||Name of the plugin|
|Dilation||f ⊕ b||dilate()||Dilate|
|Erosion||f ⊖ b||erode()||Erode|
|Open||f ο b = (f Θ b) ⊕ b||open()||Open|
|Close||f • b = (f ⊕ b) Θ b||close()||Close|
|Gradient||∇b(f) = (f ⊕ b) - (f Θ b)||gradient()||Gradient|
|TopHat||f - (f ο b)||topHat()||Top Hat|
|BottomHat||(f • b) - f||bottomHat()||Bottom Hat|
Write these operators in the corresponding Java methods and test your code on bar. The plugins are also able to process RGB images by independently applying the operator on every color channels. Insert in the report the resulting images of Gradient(Disk 7) on sunrise, Bottom Hat(Square 3) on pattern.
4. Understand the morphological operators
Apply the following morphological operators on pattern. When the image content is the same, explain why in the report.
4.2 Check duality
Check the two following duality relations in the case of an image range from 0 to 255:
Write the methods checkDualityErodeDilate() and checkDualityOpenClose() that displays the two images of the relation of duality. The method image.show("Title") allows to display an image. Apply on doisneau with the structuring element Disk 7. Fill the report.
5. Simple applications
For each application, give a sequence of few morphological operators and their parameters to complete the required task. You can combine the morphological operators (different shapes, different sizes). Fill the report.
6. Median filter
Write the routine median() that returns a median-filtered image using only the Square(3) as structuring element. To find the median value, an easy way is to sort a 1D array and finally take the central value of the sorted array as the output value. In Java, the sort procedure is achieved by the command: double array; Arrays.sort(array);
Test your code on the images doisneau-noise using the plugin Median. Fill the report.
7. Distance map from border
We propose to estimate the distance from the border of objects by iteratively eroding (structuring element Cross 3) objects until all the object pixels vanish. The input image is a binary image, objects are white (pixel value:255) and background is black (pixel value: 0). At each iteration, the eroded area (1 pixel band) is accumulated in a map M stored in an ImageAccess object with the index of the current iteration. The process runs until the current eroded image is zero everywhere.
Write the code that implements this algorithm in the method distanceBorderMap() that returns the map M defined above.
Test your code using the image Hela using the plugin Distance Border Map. Propose a "noise tolerance" of the Find Maxima command (Menu ImageJ » Process) to draw a yellow cross on every local maximum that corresponds to a HeLa cell (your results do not have to be perfect). Fill the report.
Christmas Question (not graded): Compute the distance map of the christmas-tree image.