Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
40 lines (31 loc) · 1.11 KB

File metadata and controls

40 lines (31 loc) · 1.11 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package dip.convolution;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
import org.scijava.nativelib.NativeLoader;
import java.io.IOException;
public class ApplyingKirsch {
public static void main(String[] args) throws IOException {
NativeLoader.loadLibrary(Core.NATIVE_LIBRARY_NAME);
int kernelSize = 9;
Mat source = Imgcodecs.imread("data/dip/grayscale.jpg", Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);
Mat destination = new Mat(source.rows(), source.cols(), source.type());
Mat kernel = new Mat(kernelSize, kernelSize, CvType.CV_32F) {
{
put(0, 0, -3);
put(0, 1, -3);
put(0, 2, -3);
put(1, 0 - 3);
put(1, 1, 0);
put(1, 2, -3);
put(2, 0, 5);
put(2, 1, 5);
put(2, 2, 5);
}
};
Imgproc.filter2D(source, destination, -1, kernel);
Imgcodecs.imwrite("kirsch.jpg", destination);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.