/* reference https://github.com/klevis/DigitRecognizer/blob/master/src/main/java/ramo/klevis/cnn/EdgeDetection.java*/
private static double[][] applyConvolution(int width, int height, double[][][] image, double[][] filter) {
Convolution convolution = new Convolution();
double[][] redConv = convolution.convolutionType2(image[0], height, width, filter, 3, 3, 1);
double[][] greenConv = convolution.convolutionType2(image[1], height, width, filter, 3, 3, 1);
double[][] blueConv = convolution.convolutionType2(image[2], height, width, filter, 3, 3, 1);
double[][] finalConv = new double[redConv.length][redConv[0].length];
for (int i = 0; i < redConv.length; i++) {
for (int j = 0; j < redConv[i].length; j++) {
finalConv[i][j] = redConv[i][j] + greenConv[i][j] + blueConv[i][j];
}
}
return finalConv;
}