Dyed products exhibit varying colors when illuminated by different light sources. Human eyes possess color constancy, enabling them to automatically adjust and overlook color discrepancies, effectively self-correcting visually. However, these variations are perceived as distinct colors by computers. To eliminate the effects of lighting on the dyed products, illumination correction is needed to make the dyed products show their original color. To achieve this goal, this article presents a novel algorithm, WOA-SHO-RELW (Whale Optimization Algorithm-Spotted Hyena Optimizer-Regularized Extreme Learning Machine), designed to emulate color constancy and applies it to the illumination correction of dyed products. We employ the WOA to optimize the initial population of SHO, carefully selecting a group of suitable initial parameters. Subsequently, SHO is utilized to optimize the hidden biases and input weights of RELM, with the overarching aim of enhancing the model’s effectiveness and performance, thereby ensuring more precise illumination correction for images of dyed products. The comparison results with other algorithms show that our WOA-SHO-RELM has better comprehensive performances.