I want to perform an Dilation operation while having rounded corners.
Something like this :

What I tried :
import numpy as np
import cv2
img = cv2.imread(test.jpg)
kernel = np.array([[0,1,0],
[1,1,1],
[0,1,0]], dtype=np.uint8)
img_d = cv2.dilate(img, kernel, iterations=45)
Image used : test.jpg
I tried multiple kernels (with different sizes 3x3, 5x5...) but I didn't succeed to get rounded corners.
My Question is : Can we get rounded corners just by changing the kernel or should we add a further processing step to achieve this ?
NOTE : My goal is not to create a rounded square... I used this example just to explain the idea of getting rounded corners with a dilation operation.



