如何将ROI与python中的原始扫描图像重叠?

问题描述 投票:0回答:1

我有两个医学图像。一个是“扫描图像”,另一个是该扫描图像的“感兴趣区域”(ROI)。现在,我需要叠加在另一个之上。这是原始扫描图像。enter image description here

Scan image

enter image description here

ROI image

如何重叠,这样我应该能够看到原始扫描图像中的ROI区域?。我想在python中做到这一点。

python python-3.x image image-processing roi
1个回答
0
投票

我解决了如下问题。如果有人对此感兴趣,则可以执行以下操作;

from PIL import Image

import numpy as np

img = Image.open("path/to/the/roi")

background = Image.open("path/to/the/scan/image")

background.paste(img, (0, 0), img)
background.save('path/to/save',"PNG")

结果如下所示。enter image description here

ref:click for reference

© www.soinside.com 2019 - 2024. All rights reserved.