Gold is tricky! ;) The paper I linked to in another comment
(about Paul Debevec's Light Stage) describes automatically identifying and digitizing "The Golden Haggadah"'s gold foil:

https://news.ycombinator.com/item?id=30069100

https://www.osapublishing.org/oe/fulltext.cfm?uri=oe-27-8-11...

>Multifocus HDR VIS/NIR hyperspectral imaging and its application to works of art

>[...] To demonstrate the potential interest of this processing strategy for on-site analysis of artworks, we applied it to the study of a vintage copy of the famous painting “Transfiguration” by Raphael, as well as a facsimile of “The Golden Haggadah” from the British Library of London. The second piece has been studied for the identification of highly reflective gold-foil covered areas. [...]

>[...] The sharpness index, as well as the color and spectral metrics show that it is possible to achieve good quality spectral reflectance images using a hyperspectral scanner in non-controlled illumination conditions. Moreover, as an example application, highly reflective golden material has been segmented from a facsimile. [...]

>4.3. Additional example of application: identification of golden foil in a facsimile
As a final experiment, an original facsimile from the British Library of London has been captured using the proposed framework. This facsimile (see Fig. 8), presents areas of golden highly reflective material. These kinds of materials always represent a challenge for image capturing systems. The problem is that depending on the illumination/observation geometry, the capturing device may receive specular reflections from the sample. If this happens, these areas would most probably saturate the sensor when using the exposure times needed to correctly capture the rest of the scene. Even if the illumination could be controlled, if the samples are not perfectly flat (as is the case in many artworks and illuminated manuscripts which have irregular texture), avoiding the saturated areas would not be possible by only manipulating the light sources. Therefore, even in controlled illumination laboratory conditions, the high dynamic range may still be a problem for this kind of samples. As in previous sections with the art painting, two spectral reflectance cubes of the facsimile were captured (one LDR and one HDR). These cubes were used for the automatic detection of those areas of the facsimile containing the highly reflective golden material. For such a purpose, the best results were found using the spectral metric goodness of fit coefficient (GFC) in both cases, in the near infrared spectral range from 700 to 1000 nm. The segmentations of the HDR and LDR cubes were compared with a manually segmented ground truth (shown in 8 center of bottom row). Since there are only two possible labels for each pixel (0 for non-golden material and 1 for golden material), the performance was compared as the percentage of matches between the automatic segmentations and the ground truth. [...]

>5. Conclusions and future work:
In this study, a complete framework is introduced for the hyperspectral reflectance capture of a painting in situ, and under high dynamic range conditions. Both the high dynamic range and the focusing problem due to chromatic aberrations have been overcome by using multiple captures with different focus positions and exposure times. A final hyperspectral reflectance cube has been computed using weighting maps calculated for both sample and flat fields and the quality of this cube has been tested and compared with a spectral cube captured in the usual LDR and single focus way. Our results show that the proposed method outperforms the best low dynamic range capture acquired. The sharpness index, as well as the color and spectral metrics show that it is possible to achieve good quality spectral reflectance images using a hyperspectral scanner in non-controlled illumination conditions. Moreover, as an example application, highly reflective golden material has been segmented from a facsimile. Our results show that by applying the proposed framework for capturing and processing, those areas which saturate the sensor in the usual capturingway, can be correctly exposed and segmented using the HDR multifocus capture. In future research, a new version of this framework will be developed including piecewise cube stitching for blending different cubes captured in different regions of big paintings. This will allow us to get closer to the painting and retrieve higher spatial resolution data, whilst still maintaining the spectral resolution and performance achieved in this study. Moreover, we will use the spectral reflectance images computed in this study, together with X-ray fluorescence measurements for the non-invasive pigment identification, in order to help the dating of ancient paintings and other works of art.