I do time lapses. In the attached image, notice each image has slightly different shades but are otherwise consistent. This is an artifact of a mechanical shutter.

Collection of slightly off image thumbnails

I'd like to take a single pixel in the images that will not change color and use this as the baseline. Then apply a mask to the rest of the images in the sequence to make them match the baseline image.

I imagine the code would look something like this:

baseline_color = `convert baseline.png -format '#%[hex:u.p{75,20}]' info:-`

for i in images/
    #get the color of the same pixel in another image
    new_color = `convert $i -format '#%[hex:u.p{75,20}]' info:-`

    #get the difference betwen the two colors
    diff = baseline_color - new_color

    #apply filter to make image color consistent with baseline
    ffmpeg -i $i -vf "filter=..." $i_filtered.png

Any thoughts on how to best accomplish this?

  • I may end up using normalization instead
    – user319249
    Aug 17 at 23:10
  • Alternatively, the answer may lie in the curves filter if I can make it work. Then the pseudocode above would apply.
    – user319249
    Aug 18 at 12:49
  • Another option is the histmatch ImageMagick script
    – user319249
    Aug 19 at 12:40


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.