Perform image convolution for a simple kernel on a grayscale image matrix.
HardProblem Statement
Perform image convolution for a simple kernel on a grayscale image matrix.
Sample Input
Matrix: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; Kernel: [[0, -1, 0], [-1, 4, -1], [0, -1, 0]]
Sample Output
Convolved Matrix: 0 0 4 3 0 7 16 11 22
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
using System;
class ImageConvolution
{
static void Main()
{
// Perform convolution of the matrix using the kernel
}
}
Input
Matrix: [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; Kernel: [[0, -1, 0], [-1, 4, -1], [0, -1, 0]]
Expected Output
Convolved Matrix: 0 0 4 3 0 7 16 11 22