<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 *****Not Working*******
In this notebook, we will implement matlab imfilter method in python. Here we will implement four modes know as - (clip, wrap, copy, reflect) in old_matlab, (0, circular, replicate, symmetic) in new_matlab and (constant,wrap and mirror, nearest, reflect) in scipy python.
Import Libraries
Step1:  Read Image
Step2:  Boundary filters
<ASSISTANT_TASK:>
Python Code:
import cv2
import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage as scp
Explanation: *****Not Working*******
In this notebook, we will implement matlab imfilter method in python. Here we will implement four modes know as - (clip, wrap, copy, reflect) in old_matlab, (0, circular, replicate, symmetic) in new_matlab and (constant,wrap and mirror, nearest, reflect) in scipy python.
Import Libraries
End of explanation
img = cv2.imread('paint.jpg', cv2.IMREAD_GRAYSCALE)
Explanation: Read Image
End of explanation
kernal = np.zeros((51,51))
kernal[25,25] = 1
Constant_filter = scp.correlate(img,kernal,mode='constant')
Wrap_filter = scp.correlate(img,kernal,mode='wrap')
Mirror_filter = scp.correlate(img,kernal,mode='mirror')
Nearest_filter = scp.correlate(img,kernal,mode='nearest')
Reflect_filter = scp.correlate(img,kernal,mode='reflect')
plt.figure(figsize=(10,8))
plt.subplot(2,3,1), plt.imshow(img, cmap='gray'), plt.title('Original')
plt.subplot(2,3,2), plt.imshow(Constant_filter, cmap='gray'), plt.title('Constant_filtered')
plt.subplot(2,3,3), plt.imshow(Wrap_filter, cmap='gray'), plt.title('Wrap_filtered')
plt.subplot(2,3,4), plt.imshow(Mirror_filter, cmap='gray'), plt.title('Mirror_filtered')
plt.subplot(2,3,5), plt.imshow(Nearest_filter, cmap='gray'), plt.title('Nearest_filtered')
plt.subplot(2,3,6), plt.imshow(Reflect_filter, cmap='gray'), plt.title('Reflect_filtered')
plt.show()
Explanation: Boundary filters
End of explanation
<END_TASK>