The context here is that I am writing a code that combines multiple image pre-processing techniques, including converting images into grayscale (luminescence) images, to be applied on some arbitrary video file.
Currently feeding grayscale images to my code right now, but stumbled across an interesting observation when converting an image (that I'm pretty sure is grayscale, unless my eyes deceive me) to a grayscale image once again. Check the link below.
On the left is the original screenshot. On the right is the image converted using skimage.color.rgb2gray NOTE: the two images shown in link are not 100% identical; I just put the two images next to each other before uploading them to here, but their appearance is the main take-away.
I'm curious if anyone here could share any insights into what is going on when I feed the original image into skimage's color conversion method. Pasted a snippet of my code below for y'all's own perusal. Not the best Python programmer and have been learning a lot while coding, so please let me know if there's anything egregious with what I did here.
Would greatly appreciate all help and insights! Thanks in advance.
while capture.isOpened():
read_success, frame_uint8 = capture.read()
if not read_success:
print("Converted all native frames into grayscale.")
break
frame_filepath = os.path.join(frameFolder, 'Frame{}.tiff'.format(frameID))
cv.imwrite(frame_filepath, frame_uint8)
frame_float = frame_uint8.astype(np.float64) / 255.0
gray_result_float = skimage.color.rgb2gray(frame_float)
gray_result_uint8 = (gray_result_float * 255.0).astype(np.uint8)
gray_filepath = os.path.join(GRAYFolder, 'Frame{}.tiff'.format(frameID))
cv.imwrite(gray_filepath, gray_result_uint8)
capture.release()
Looked at skimage's documentation and saw that their RGB-grayscale conversion equation is as follows: Y = 0.2125 R + 0.7154 G + 0.0721 B. I understand people assign different weights to this general equation and that the differences aren't that noticeable, but could these seemingly arbitrary weights be contributing to the difference between these two images?
Booted up Adobe Photoshop and used its color dropper tool to pick up the HSB values of both images for a sanity check. The original image on the left has [0, 0, x] generally across all its pixels (where 20 < x < 50), but the converted image on the right has [120, y, z] (where y < 10 and 20 < z 50)