<p>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.</p>
<p><a href="https://i.sstatic.net/LLzeD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LLzeD.png" alt="Collection of slightly off image thumbnails" /></a></p>
<p>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.</p>
<p>I imagine the code would look something like this:</p>
<pre><code>baseline_color = `convert baseline.png -format '#%[hex:u.p{75,20}]' info:-`

for i in images/
do
    #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 &quot;filter=...&quot; $i_filtered.png
done
</code></pre>
<p>Any thoughts on how to best accomplish this?</p>

CC BY-SA 4.0
2022-08-17T23:10:03.640Z
I may end up using [normalization](http://johnriselvato.com/ffmpeg-how-to-add-color-normalization-to-a-video/) instead
user319249
CC BY-SA 4.0
2022-08-18T12:49:29.387Z
Alternatively, the answer may lie in the curves filter if I can make it work. Then the pseudocode above would apply.
user319249
CC BY-SA 4.0
2022-08-19T12:40:52.303Z
Another option is the [histmatch](http://www.fmwconcepts.com/imagemagick/histmatch/index.php) ImageMagick script
user319249
<ffmpeg><filter><time-lapse>
Applying dynamic mask across all images to make uniform with baseline
user319249
# Applying dynamic mask across all images to make uniform with baseline

(Asked by: username_0 on 2022-08-17)

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.

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/
do
    #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
done

Any thoughts on how to best accomplish this?

**Tags:** ffmpeg, filter, time-lapse

> **Comments:**
> **username_0**: I may end up using [normalization](http://johnriselvato.com/ffmpeg-how-to-add-color-normalization-to-a-video/) instead  
> **username_0**: Alternatively, the answer may lie in the curves filter if I can make it work. Then the pseudocode above would apply.  
> **username_0**: Another option is the [histmatch](http://www.fmwconcepts.com/imagemagick/histmatch/index.php) ImageMagick script  

---

## 0 answers

