3os.environ[
"OPENCV_IO_MAX_IMAGE_PIXELS"] = pow(2,40).__str__()
9from collections
import namedtuple
11vec3 = namedtuple(
'vec3',
'x y z')
14 s = 1.0/np.sqrt(v.x*v.x + v.y*v.y + v.z*v.z)
15 return vec3(s*v.x, s*v.y, s*v.z)
18img = cv2.imread(
"Q:\\360\\starmap_2020_64k.png")
54t = vec3(( 2.0/s)*(np.outer(np.ones(s),np.arange(s))+0.5) - 1.0,
55 ( 2.0/s)*(np.outer(np.arange(s),np.ones(s))+0.5) - 1.0,
56 -np.outer(np.ones(s),np.ones(s)))
59print(
"s={}".format(s))
62 d = vec3(basis[0][0]*t.x + basis[0][1]*t.y + basis[0][2]*t.z,
63 basis[1][0]*t.x + basis[1][1]*t.y + basis[1][2]*t.z,
64 basis[2][0]*t.x + basis[2][1]*t.y + basis[2][2]*t.z)
67 u = (img.shape[1]*((0.5/np.pi)*(np.arctan2(d.y, d.x)+np.pi))).astype(int)
68 v = (img.shape[0]*((1.0/np.pi)*np.arccos(d.z))).astype(int)
73 path =
"Q:\\360\\moo\\out{}.png".format(f)
74 cv2.imwrite(path, resample)
75 print(
"Wrote {}".format(path))