반응형
# color pallet
grid_2D = grid_3D[0, :2].view(2, -1) # 2 (h w)
radius = grid_2D.pow(2).sum(0).unsqueeze(0) # 1 (h w)
radius = radius / radius.max()
radian = torch.atan2(grid_2D[1], grid_2D[0])
chk_m = radian < 0
radian[chk_m] += 2 * np.pi # from (-pi, pi) to (0, 2pi)
h = (radian-radian.min()) / (radian.max()-radian.min()) # normalized from 0-1
s = radius # saturation is set as a function of radias
v = torch.ones_like(s) # value is constant
# convert the np arrays to lists. This actually speeds up the colorsys call
import colorsys
h,s,v = h.flatten().tolist(), s.flatten().tolist(), v.flatten().tolist()
c = [colorsys.hsv_to_rgb(*x) for x in zip(h,s,v)]
c = np.array(c)
'Linux' 카테고리의 다른 글
at 사용법 (0) | 2023.08.17 |
---|---|
execution time scheduler 'at' (0) | 2023.06.23 |
CUDA Installation error, NVIDIA-drm in use (0) | 2023.05.03 |
myelin error in operator(): 1 (myelinversionmismatch : compiled assuming that device 0 was sm 75, but device 0 is sm 0. ) (0) | 2022.01.27 |
Install OpenCV + Cuda + cuDNN + TensorRT on Ubuntu 18.04 (0) | 2022.01.27 |