Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test的输出结果问题 #29

Open
ymyj opened this issue May 31, 2024 · 2 comments
Open

test的输出结果问题 #29

ymyj opened this issue May 31, 2024 · 2 comments

Comments

@ymyj
Copy link

ymyj commented May 31, 2024

MIF在test运行后的输出PET_MRI结果图仍然为灰度图,我想知道做哪些修改可以让输出和作者您论文中的彩色结果保持一致,期待你的回复,十分感谢

@ymyj
Copy link
Author

ymyj commented Jun 1, 2024

MIF在测试运行后的输出PET_MRI结果图仍然为灰度图,我想知道做哪些修改可以让输出和作者您论文中的彩色结果保持一致,期待你的回复,十分感谢

41
41
41

@Linfeng-Tang
Copy link
Owner

实验中是使用了YCbCr来进行后处理的 你也可以在融合图像保存代码之后加一个im2RGB 的操作
函数如下 其中f_name表示融合图像的保存路径 vi_name 可以使用PET图像的路径即可
def img2RGB(f_name, vi_name):
scale = 32
vi_img = Image.open(vi_name)
vi_img = vi_img.convert('YCbCr')

f_img = Image.open(f_name).convert('L')
w, h = f_img.size

vi_img = vi_img.resize((w, h), PIL.Image.ANTIALIAS)
vi_Y, vi_Cb, vi_Cr = vi_img.split()
f_img = Image.open(f_name).convert('L')
f_img = Image.merge('YCbCr', (f_img, vi_Cb, vi_Cr))
f_RGB = f_img.convert('RGB')
f_RGB.save(f_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants