aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/Filter.java
blob: ddc3e920f485acf98671c96996b247082545d7f4 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
 * @author Pacien TRAN-GIRARD
 * @author Timothée FLOURE
 */
public final class Filter {

    /**
     * Get a pixel without accessing out of bounds
     *
     * @param gray a HxW float array
     * @param row  Y coordinate
     * @param col  X coordinate
     * @return nearest valid pixel color
     */
    public static float at(float[][] gray, int row, int col) {
        // TODO at
        return 0.0f;
    }

    /**
     * Convolve a single-channel image with specified kernel.
     *
     * @param gray   a HxW float array
     * @param kernel a MxN float array, with M and N odd
     * @return a HxW float array
     */
    public static float[][] filter(float[][] gray, float[][] kernel) {
        // TODO filter
        return null;
    }

    /**
     * Smooth a single-channel image
     *
     * @param gray a HxW float array
     * @return a HxW float array
     */
    public static float[][] smooth(float[][] gray) {
        // TODO smooth
        return null;
    }

    /**
     * Compute horizontal Sobel filter
     *
     * @param gray a HxW float array
     * @return a HxW float array
     */
    public static float[][] sobelX(float[][] gray) {
        // TODO sobelX
        return null;
    }

    /**
     * Compute vertical Sobel filter
     *
     * @param gray a HxW float array
     * @return a HxW float array
     */
    public static float[][] sobelY(float[][] gray) {
        // TODO sobelY
        return null;
    }

    /**
     * Compute the magnitude of combined Sobel filters
     *
     * @param gray a HxW float array
     * @return a HxW float array
     */
    public static float[][] sobel(float[][] gray) {
        // TODO sobel
        return null;
    }

}