-
Notifications
You must be signed in to change notification settings - Fork 19
请问您是怎样让生成的网格可视化的? #8
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
Comments
把mesh中每个像素的值归一化再乘255,然后保存为图像就ok |
这是我利用您的代码训练后进行测试,得到的一个文档的网格,为什么我可视化后是灰色的,不是向您那样的彩色?还有就是我利用这个网格,通过inverse_deform得到的复原图像跟原始测试图像相差不大,基本没有实现复原,是因为我生成的网格不对吗?
…------------------ 原始邮件 ------------------
发件人: "wuleiaty/DocUNet" ***@***.***>;
发送时间: 2021年4月9日(星期五) 下午2:51
***@***.***>;
***@***.******@***.***>;
主题: Re: [wuleiaty/DocUNet] 请问您是怎样让生成的网格可视化的? (#8)
把mesh中每个像素的值归一化再乘255,然后保存为图像就ok
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
可视化图是灰色还是彩色可能和您保存为灰度图像或者RGB图像有关,至于第二个问题,我也不能确定什么原因 |
1.最后生成的label_x\label_y尺寸都是(256,256),不是只能是灰度图吗,怎么保存成彩色图呢,您可视化的代码还有吗?
…------------------ 原始邮件 ------------------
发件人: "wuleiaty/DocUNet" ***@***.***>;
发送时间: 2021年4月9日(星期五) 下午4:45
***@***.***>;
***@***.******@***.***>;
主题: Re: [wuleiaty/DocUNet] 请问您是怎样让生成的网格可视化的? (#8)
可视化图是灰色还是彩色可能和您保存为灰度图像或者RGB图像有关,至于第二个问题,我也不能确定什么原因
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
尺寸应该不变,每个像素的值范围为0-255吧,这是我可视化的代码,供你参考: import matplotlib.pyplot as plt
import matplotlib.image as mig
from matplotlib import cm
import numpy as np
import os
import scipy.io as sci
label_path = "/home/wulei/big_dset_crop/labels/3128-0.npz"
filename = label_path.split("/")[-1][0:-4]
save_folder = "label_vis"
if not os.path.exists(save_folder):
os.mkdir(save_folder)
is_mat = False
if label_path[-4:] == ".npz":
label = np.load(label_path)
label_x, label_y = label['x'], label['y']
else:
is_mat = True
label = sci.loadmat(label_path)['fm']
label_x, label_y = label[:,:,0], label[:,:,1]
x_max, x_min, y_max, y_min = np.max(label_x), np.min(label_x), np.max(label_y), np.min(label_y)
print(x_max, y_max)
for i in range(label_x.shape[0]):
for j in range(label_x.shape[1]):
if label_x[i][j] < 0:
label_x[i][j] = 100
else:
label_x[i][j] = (label_x[i][j] / x_max) * 255
if label_y[i][j] < 0:
label_y[i][j] = 100
else:
label_y[i][j] = (label_y[i][j] / y_max) * 255
# 彩色
plt.imsave(os.path.join(save_folder, filename + ("-gt" if is_mat else "") + "-x.png"), label_x)
plt.imsave(os.path.join(save_folder, filename + ("-gt" if is_mat else "") + "-y.png"), label_y)
# 灰度
# mig.imsave(os.path.join(save_folder, filename + ("-gt" if is_mat else "") + "-x.png"), np.uint8(label_x), cmap=cm.gray)
# mig.imsave(os.path.join(save_folder, filename + ("-gt" if is_mat else "") + "-y.png"), np.uint8(label_y), cmap=cm.gray) |
那个我能问一下这个代码具体要怎么执行吗?texture_folder那几个路径下放的是什么呀,没有弄的 |
您好,请问您解决了吗 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: