Picture two adjacent regions in a brightfield image of an IHC slide. One region has chromogen concentration c; the other has concentration 2c. In transmittance, the brighter region (concentration c) reads — say — 100 on an 8-bit pixel scale, and the darker region (concentration 2c) reads 25. The naïve average is (100 + 25) / 2 = 62.5, which corresponds to some intermediate concentration we'd compute by inverting Beer-Lambert on 62.5 — and that concentration is not 1.5c. It's higher than that, because the exponential weights the darker pixel more heavily.
Convert to OD first: the bright region has OD = −log(100/255) ≈ 0.41; the dark region has OD = −log(25/255) ≈ 1.01. The average OD is (0.41 + 1.01) / 2 = 0.71, and this average is the OD of 1.5c concentration (up to the path-length and extinction-coefficient constants). Average concentration computed correctly.
This isn't a small effect. The error from averaging RGB intensities instead of OD can be 20% or more when the underlying concentration distribution varies appreciably across the region — and quantitative IHC scoring routinely relies on per-region averages. The RGB-to-OD conversion engineLoading... is the standard preparation; running it before any region-averaging engine is what makes the measurements correspond to the biology.