Reputation: 350
I have a binary image and I want to achieve the following -
If a pixel is white, make it's nearby 10x10 pixels white.
I know I can do it by using convolutions and a kernel, but are there any functions in opencv that can do this?
Upvotes: 2
Views: 201
Reputation: 21203
To better illustrate my comment here is an example.
This is the image:
Performing dilation using a kernel of size 5 x 5:
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5))
dilation = cv2.dilate(img, kernel, iterations = 1)
cv2.imshow('dilation', dilation)
This is the result:
Upvotes: 2