Skip to content

Commit 62eba36

Browse files
committed
MorphologicalClose->MorphologicalCloseProcess and implements ImageProcess
1 parent a1e0676 commit 62eba36

File tree

2 files changed

+34
-62
lines changed

2 files changed

+34
-62
lines changed

MorphologicalClose.java

-62
This file was deleted.

MorphologicalCloseProcess.java

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* This program will perform a morphological open operation using JAI
3+
*
4+
* @author Christopher Sasarak
5+
*/
6+
import javax.media.jai.*;
7+
import java.awt.image.RenderedImage;
8+
9+
/**
10+
* @class Performs a morphological open operation; this is an erode followed by a dilation.
11+
*/
12+
public class MorphologicalCloseProcess implements ImageProcess{
13+
/**
14+
* This method takes an image and then returns it after performing a
15+
* morphological close operation, which basically means
16+
* erode the image, then dilate it using the same structuring element.
17+
*
18+
* @param img The image to convert perform a morphological open operation on
19+
* @return RenderedImage The image after
20+
*/
21+
public RenderedImage process(RenderedImage img){
22+
float disk[] ={0, 0, 1, 1, 1, 0, 0,
23+
0, 1, 1, 1, 1, 1, 0,
24+
1, 1, 1, 1, 1, 1, 1,
25+
1, 1, 1, 1, 1, 1, 1,
26+
1, 1, 1, 1, 1, 1, 1,
27+
0, 1, 1, 1, 1, 1, 0,
28+
0, 0, 1, 1, 1, 0, 0};
29+
30+
KernelJAI kern = new KernelJAI(7,7,disk);
31+
RenderedImage erode = JAI.create("dilate", img, kern, null);
32+
return JAI.create("erode",img, kern, null);
33+
}
34+
}

0 commit comments

Comments
 (0)