Closed TianhaoFu closed 3 years ago
Are you looking for this? https://github.com/shariqfarooq123/AdaBins/blob/2fb686a66a304f0a719bc53d77412460af97fd61/utils.py#L49 :
For numpy arrays:
import matplotlib
def colorize(arr, vmin=0.1, vmax=10, cmap='magma_r', ignore=-1):
invalid_mask = arr == ignore
# normalize
vmin = arr.min() if vmin is None else vmin
vmax = arr.max() if vmax is None else vmax
if vmin != vmax:
arr = (arr - vmin) / (vmax - vmin) # vmin..vmax
else:
# Avoid 0-division
arr = arr * 0.
cmapper = matplotlib.cm.get_cmap(cmap)
arr = cmapper(arr, bytes=True) # (nxmx4)
arr[invalid_mask] = 255
img = arr[:, :, :3]
return img
Cmaps used in paper are 'jet' and 'magma_r'. You can find other color maps here
Hi, Thanks for your code.
Could you please provide the visualization code of nyud predicted depth or the heat map of nyud predicted depth?
Thank you very much!