[FFmpeg-user] how to invert a colormap implemented with filter_complex

Paul B Mahol onemda at gmail.com
Thu Jun 22 20:25:12 EEST 2023

On Thu, Jun 22, 2023 at 7:12 PM Audette, Michel A. <maudette at odu.edu> wrote:

> Dear members of the ffmpeg community,
> I'm trying to visualize the deep neural network-based depth estimation
> result based on a video input, using code available on GitHub:
> https://github.com/tinghuiz/SfMLearner . There is a demo on that page
> whose visualization is exactly right: a purple-to-yellow colormap that
> corresponds to plasma. e.g.:
> [cid:d60c3a17-abd3-469a-978f-90199c4baf1f]
> I believe that the implementation is along the lines of the following:
>  -filter_complex "pseudocolor=p=plasma"

If I understood your problem correctly, you use pseudocolor filter with
preset option plasma and get inverted result?
pseudocolor operates (when used with preset option) on single input video
pixels plane.
So to get inverted output use something like this:

-filter_complex "negate,pseudocolor=p=plasma"

But if you wanted to fix already color mapped content, that is much less
straightforward solution and more complex.

> However, my current result has the proximate objects mapped to dark purple
> and the furthest objects appearing in yellow, which is counterintuitive
> from a saliency standpoint.
> [cid:ce889fa7-fb3e-49d8-878c-bf66728a98c5]
> It is the opposite of what I would like to achieve.
> How can I invert this mapping, while retaining that particular plasma
> colormap?
> If I try to use -lutrgb="r=negval:g=negval:b=negval", right after the
> -filter_complex command, I get "unrecognized option".
> Thanks for your support.
> Michel
> Michel Audette, Ph.D.
> Associate Professor, Department of Electrical and Computer Engineering,
> Graduate Program Director, Biomedical Engineering,
> Old Dominion University,
> Norfolk, VA.
> maudette at odu.edu; office phone: 757-683-6940.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

More information about the ffmpeg-user mailing list