HSL is the best color space to represent grayness.
Grayness can be seen as a distance S (saturation), which is 0.0 if pure gray, and 1.0 if it is the farthest from gray.
Measure and perception
In the two samples provided I measured (with Photoshop eyedropper):
0 10% 49% and 216 12% 51% which differs a bit from what you claimed, maybe due to a color profile being dropped in the publication process.
With a calibrated Eizo CG303w (120cd/m2 5000k 2.2), I have the feeling that the one on the left tend to the red and the one one right on the blue. I lowered the saturation until I had the feeling both were gray, I reached 4% and 5% saturation in the HSL space.
My 5000k for the white point is a bit warm, and I see the brown patch more colored than the blue one. Likely a white point at 5500k-6500k would be better and we should also make sure that ambient light (idealy a calibrated light such as Just) and wall color (white, dirty white ?) are in the range of acceptable grayness.
Discussion
In RGB, a color is gray when R=G=B, but the operator needs to evaluate several numbers in order to answer to "is it grey". It is harder to give ourselve a distance from R=G=B just by looking at the numbers.
HSL color space is more direct since S (saturation, in the range [0,1]) gives immediately the answer: 0 is grey or a value below a threshold is chosen to be gray.
R' = R/max // normalization from [0-max] to [0.0-1.0]
G' = G/max // where max is 255 if the colors are 8 bits per channel
B' = B/max
Cmax = max(R', G', B') // find the maximum among R,G,B
Cmin = min(R', G', B') // find the minimum among R,G,B
Δ = Cmax - Cmin // gives the maximum difference
And yet, L and S are given by:
L = (Cmax + Cmin) / 2
S = Δ/(1-|2L-1|)
Hence you can build an indicator filter than will display say in pure green when pixels are pure gray or enough gray; or that will display in false colors all the gray enough pixels, and destaturate the rest. Implementation will depend on your software and langage; you can create a Matlab filter for Photoshop for instance that will do that, or even an autonomous plugin.
References
- RapidTables RGB to HSL
- Photoshop Matlab