Below is the code I have written to convolve an image with a x-direction Sobel mask. The function inputs a gray-scale image along with a kernel to be convolved with. However, the result I am getting is different compared to the result I get from the built-in conv2() function. Why is that? What am I doing wrong?
Here's my function's output:
Here's conv2() output: