I have this image:
I want to whiten the black contours (borders) around it without affecting the image content. Here is the code I used:
import cv2
image = cv2.imread('filename.jpg')
height, width, channels = image.shape
white = [255, 255, 255]
black = [0, 0, 0]
for x in range(0,width):
for y in range(0, height):
channels_xy = image[y, x]
if all(channels_xy == black):
image[y, x] = white
cv2.imwrite('result.jpg', image)
The black borders are whitened (well not 100%), but the writing in the image has been affected too
Is there any suggestion to better whiten to black borders without affecting the image content?