I then converted to grayscale using a weighted average of RGB values; the formula is grayscale_img = R * 0.2989 + G * 0.587 + B * 0.114. The resulting image is below.
I then decided to adjust the contast of the image. This is done by scaling the residuals of the spatial image mean.
The formula is contrast_adjusted = (img - mean) * contrast_factor + mean. Mean is the spatial color mean, so it's a vector of size 3.
I set the contrast factor to 2. The out of range pixel values are clipped. The resulting image is below.
Credits: Tensorflow documentation for contrast adjustment formula. Wikipedia for grayscale conversion formula