[Python] how do I overlay an image clip onto an image of different size?

Discussão em 'Python' iniciado por Stack, Agosto 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am comparing clips of one image (Image A) to another image (Image B). Image A and B are the same size; the clip (Clip) is smaller than Image A or B. Clip is ostensibly seen in Image B, just from a different angle, making it look slightly different. I want to plot Clip on top of its appropriate location in Image B to have a visual check.

    I've been told to use 'extents' when plotting, but that just shrinks the display to the size of Clip, which then means I no longer have the context I need, making it pointless. Instead of Clip overlaying part of Image B, Clip covers everything.

    I could just overwrite a copy of Image B with Clip, but then I might not be able to tell where Clip is and therefore not give a proper visual check.

    How do I overlay Clip on top of Image B in a different color and transparency while showing all of Image B?

    Alternatively, what would be a way to highlight the region that has been changed?

    For the image example below, Image A and Image B are the same.

    I'm using Python 3.12 and matplotlib.pyplot.

    [​IMG]

    Continue reading...

Compartilhe esta Página