Sounds like you’re making a colorimeter… ??
Regarding the additional corrections:
- Lens transmissivity: If you can get your hands on a spectrophotometer, you should be able to measure your lens with a full-spectrum light shining through the wide-open lens. Now, that set of measurements will need to also be compensated for the light’s spectral power distribution, but that would be trivial - just remove the lens, and measure the light directly. @ilia3101 has some plots of the sort of data you’ll need here: https://discuss.pixls.us/t/high-quality-spectral-response-data-incoming/28497/16
- Defective pixels: If the measured patch of color is relatively uniform, taking the median of each of the three channels should eliminate the effect of defective pixels.
For my camera profiling, I worked a bit on making a Raspberry Pi spectrophotometer, with a RPi and a monochrome camera. Stopped working on it when I discovered the monochrome camera had a 660nm IR cutoff filter, which obliterated any measurements above that.
Have Fun!!