I am trying to make it easier for Canny Edge detection to find edges by exaggerating differences in colors in an image.
As you can see, Canny omits most of the border of the countertop because the colours are way too similar to be picked up.
Is there a way to increase the contrast or exaggerate color differences in the image?
Unfortunately, this isn’t built-in to opencv from some research.
But, I did find a method on increasing the contrast of an image on the opencv documentation. Try stealing the code from here.
The specific portion you may be looking for:
alpha = 1.0 # Simple contrast control beta = 0 # Simple brightness control for y in range(image.shape): for x in range(image.shape): for c in range(image.shape): new_image[y,x,c] = np.clip(alpha*image[y,x,c] + beta, 0, 255)
Answered By – jvyden