Since we are already familiar with the basics, let's jump right into the code. I am skipping the header declarations because they remain the same as we saw in our previous code:
int main() { Mat input_image = imread("lena.png", IMREAD_GRAYSCALE); Mat filtered_image; blur(input_image, filtered_image, Size(3, 3), Point(-1, -1), BORDER_REPLICATE); imshow("Original Image", input_image); imshow("Filtered Image", filtered_image); waitKey(0); return 0; }
The first thing that you notice about the blur()
function is that the number of arguments is less than its counterpart. Upon a closer inspection, you'll find that the following two arguments are missing:
Depth of the output image: According to OpenCV's documentation for
blur()
, the output image has the same size and type as the source image. Since the equality between the input and output image types is already enforced by the implementation...