Noticed some artifacts in a few H.264 clips recorded with 5D Mark III and 50/1.8 at f/22, crop_rec set to 1:1. Apparently these are caused by dust on the sensor and made obvious at narrow apertures. Here's one frame:
%%shell ffmpeg -loglevel quiet -hide_banner -i sample.mov -vframes 1 -y sample.ppm convert sample.ppm sample.jpg # for preview
Luckily, the spot was large enough to be noticed on the camera screen, so I've recorded a short clip with just the blank sky, moving the camera around to average out the clouds.
%%shell ffmpeg -loglevel quiet -hide_banner -i sky.mov -f image2pipe -vcodec ppm - | convert - -evaluate-sequence mean sky.ppm convert sky.ppm sky.jpg # for preview
Let's get a flat frame out of this!
sky = double(imread('sky.ppm')); sr = sky(:,:,1); sg = sky(:,:,2); sb = sky(:,:,3); ref = sky * 0; ref(:,:,1) = mean(sr(:)); ref(:,:,2) = mean(sg(:)); ref(:,:,3) = mean(sb(:)); flat = sky ./ ref; imshow(flat / 2)