I want to preprocess images so as to create a black and white image that contains the magnitude of the color gradient at each pixel.
Let me describe the problem in detail.
Assume we have 2 pixels P_1, P_2
if P_1 = [255, 0, 0]
and P_2 = [0,255,0]
Their grayscale values on a naive grayscale are P_1 = 255/3, P_2 = 255/3
if P_1 =[255,0,0]
and P2 = [255,0,0]
once again P_1 = P_2 = 255/3
However if we look at an approximation of the gradient at those pixels.
For the first case G = P_1 - P2 = [255, -255, 0]
for the second case G = [0,0,0]
Clearly those 2 are different.
I need to get this saliency map due to the following problem with grayscaling:
Original image
Zoom:
Gray scale:
As you can see, when grayscaling, 2 regions with different colors get mapped to the same grey value.
My goal is to enhance edge detection, so what I want is to accentuate regions where there is a change in color, the opposite of what may happen when grayscaling.
For this effect I used opencv laplacian function to get the gradients, and then I turned the gradient's vector magnitude into a scalar. Which gives the following result:
It is better, but I want to know if there are other things I can do in addition to this, for example a deconvolution algorithm.