Image negatives, most of you might have heard this term, in good old days were used to produce images. Film Photography has not yet become obsolete as some wedding photographers are still shooting film. Because one has to pay for the film rolls and processing fees, most people have now switched to digital.
I recently heard of Foveon X3 direct image sensor which claims to combine the power of digital sensor with the essence of the film. (Check here)
Image negative is produced by subtracting each pixel from the maximum intensity value. e.g. for an 8-bit image, the max intensity value is 28– 1 = 255, thus each pixel is subtracted from 255 to produce the output image.
Thus, the transformation function used in image negative is
s = T(r) = L – 1 – r
Where L-1 is the max intensity value and s, and r
For gray scale image, light areas appear dark and vice versa. For
import numpy as np
# Load the image
img = cv2.imread('D:/downloads/forest.jpg')
# Check the datatype of the image
# Subtract the img from max value(calculated from dtype)
img_neg = 255 - img
# Show the image
The output looks like this
There is a long debate going on whether black on white or white on black is better. To my knowledge, Image negative favors black on white thus it is suited for enhancing the white or gray information embedded in the dark regions of the image especially when the black areas are dominant in size.
Application: In grayscale images, when the background is black, the foreground gray levels are not clearly visible. So, converting background to white, the gray levels now become more visible.
In the next blog, we will discuss Log transformations in detail. Hope you enjoy reading.
If you have any doubt/suggestion please feel free to ask and I will do my best to help or improve myself. Good-bye until next time.