Last active
October 1, 2021 06:44
-
-
Save ES-Alexander/7d6738d27d909ccdd2e63788b5e73394 to your computer and use it in GitHub Desktop.
Inpaint black regions around stitched images with a blurred effect using the image edge colours.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
image = cv2.imread('combine.jpg') | |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |
mask = (gray == 0).astype('uint8') * 255 | |
blurred = cv2.GaussianBlur(mask, (15,15), 10) | |
result = cv2.inpaint(image, blurred, 3, cv2.INPAINT_TELEA) | |
cv2.imshow('result', result) | |
print('press any key to exit') | |
cv2.waitKey(0) | |
cv2.destroyWindow('result') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment