Skip to content

Commit b19c335

Browse files
committed
The algorithm basically works.
It isn't as "smooth" as other implementations, and I would like to it to be. I'm going to look into different orderings of the operations in ImageProcessor to see if that's an improvement, and also check that I didn't make a mistake somewhere in my implementation.
1 parent bb0af19 commit b19c335

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

SobelDetectionProcess.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import javax.media.jai.KernelJAI;
1111
import javax.media.jai.JAI;
1212
import java.awt.image.RenderedImage;
13-
public class SobelDetection implements ImageProcess{
13+
public class SobelDetectionProcess implements ImageProcess{
1414

1515
/**
1616
* Return the parameter image after performing
@@ -20,5 +20,12 @@ public class SobelDetection implements ImageProcess{
2020
* @return RenderedImage The image with detection performed.
2121
*/
2222
public RenderedImage process(RenderedImage img){
23+
float[] hx = {-1,0,1,-2,0,2,-1,0,1};
24+
float[] hy = {-1,-2,-1,0,0,0,1,2,1};
25+
KernelJAI kernX = new KernelJAI(3,3, hx);
26+
KernelJAI kernY = new KernelJAI(3,3, hy);
27+
28+
img = JAI.create("convolve", img, kernY);
29+
return JAI.create("convolve", img, kernX);
2330
}
2431
}

0 commit comments

Comments
 (0)