1

I have a set of RGB images (size (400,200,3)) that I'm animating using matplotlib.animation and I want to overlay an RGBA image (size (400,200,4)) on top of them. It seems that FFMPEG is choking on the alpha data that gets added when I overlay the second image using axes.add_image() (it works fine without the overlay). I was wondering if there is a way to overlay the second image and eliminate the alpha data before I pass it along to matplotlib.animation as I think this will solve the problem.

I'm using python 2.7.9 and matplotlib 1.4.2.

4

1 回答 1

1

你有一个两步问题。首先您需要组合到 RGBA 图像,然后您要映射 RGBA -> RGB。请注意,通过将 alpha 蒙版设置为完全不透明,将您的第一张图像从 RGB -> RGBA 映射是微不足道的。这两个问题都已经在 SO 上解决了。

  1. 结合 RGBA + RGBA

    通过组合两种颜色确定接收到的 RGBA 颜色

  2. 映射 RGBA -> RGB

    将 RGBA 颜色转换为 RGB

于 2015-01-17T20:16:27.680 回答