Development of an Optimized Flat-field Correction Algorithm for Digital Cameras