Denoising Photographs Using Dark Frames Optimized by Quadratic Programming