diff --git a/CharacterInfo.json b/CharacterInfo.json new file mode 100644 index 0000000000000000000000000000000000000000..062dfc57e3f7185f45af803888784f0beb0d5b71 --- /dev/null +++ b/CharacterInfo.json @@ -0,0 +1,404 @@ +{ + "CharacterInfo": [ + { + "index": "101", + "folderName": "Camel", + "zh": "骆驼", + "eng": "a camel with light brown fur, long legs, a slender neck, a small hump on its back", + "eng_short": "a camel", + "isCity": 0 + }, + { + "index": "102", + "folderName": "Crocodile", + "zh": "鳄鱼", + "eng": "a crocodile with rough and scaly skin, a long tail, powerful limbs, and an elongated and pointed snout", + "eng_short": "a crocodile", + "isCity": 0 + }, + { + "index": "103", + "folderName": "Cassowary", + "zh": "鸵鸟", + "eng": "a cassowary with dark feathers, a blue neck, red wattle, and a prominent helmet-like crest on its head", + "eng_short": "a cassowary", + "isCity": 0 + }, + { + "index": "104", + "folderName": "Chicken", + "zh": "鸡", + "eng": "a chicken with body covered in brown feathers, red comb on head, yellow legs with sharp claws, pointed beak", + "eng_short": "a chicken", + "isCity": 0 + }, + { + "index": "105", + "folderName": "Cow", + "zh": "牛", + "eng": "a cow with body covered in black and white patches, sturdy legs with hooves, broad head with small horns", + "eng_short": "a cow", + "isCity": 0 + }, + { + "index": "107", + "folderName": "Pig", + "zh": "猪", + "eng": "a pink pig with a round body, short legs, a flat snout, and small ears", + "eng_short": "a pink pig", + "isCity": 0 + }, + { + "index": "108", + "folderName": "BaldEagle", + "zh": "秃鹰", + "eng": "a baldeagle with body covered in dark feathers, yellow talons with sharp black claws, yellow and hooked beak", + "eng_short": "a baldeagle", + "isCity": 0 + }, + { + "index": "109", + "folderName": "Bear", + "zh": "熊", + "eng": "a bear with body covered in brown fur, strong legs with sharp claws, broad head with small ears and pointed snout", + "eng_short": "a bear", + "isCity": 0 + }, + { + "index": "110", + "folderName": "Rhinoceros", + "zh": "犀牛", + "eng": "a rhinoceros with body covered in thick gray skin, two sharp horns on snout, sturdy legs with wide feet, small ears", + "eng_short": "a rhinoceros", + "isCity": 0 + }, + { + "index": "111", + "folderName": "Cat", + "zh": "猫", + "eng": "a cat with body covered in black and white fur, pointed ears, bright yellow eyes, slender legs with soft paws, long tail", + "eng_short": "a cat", + "isCity": 0 + }, + { + "index": "112", + "folderName": "RedDeer", + "zh": "鹿", + "eng": "a deer with body covered in black fur with golden markings, large antlers, slender legs with hooves, and a pointed snout", + "eng_short": "a dear", + "isCity": 0 + }, + { + "index": "113", + "folderName": "Dog", + "zh": "狗", + "eng": "a dog with body covered in black and white fur, pointed ears, long tail, slender legs with paws, mouth slightly open", + "eng_short": "a dog", + "isCity": 0 + }, + { + "index": "114", + "folderName": "Fox", + "zh": "狐狸", + "eng": "a fox with body covered in reddish-orange fur, bushy tail, pointed ears, slender legs, and a narrow and pointed snout", + "eng_short": "a fox", + "isCity": 0 + }, + { + "index": "115", + "folderName": "Goat", + "zh": "山羊", + "eng": "a goat with body covered in brown fur, curved horns, small beard, sturdy legs with hooves, short tail, and narrow face", + "eng_short": "a goat", + "isCity": 0 + }, + { + "index": "117", + "folderName": "PolarBear", + "zh": "北极熊", + "eng": "a polar bear with body covered in white fur, large paws with sharp claws, muscular build, broad head, and small ears", + "eng_short": "a polar bear", + "isCity": 0 + }, + { + "index": "119", + "folderName": "Sheep", + "zh": "绵羊", + "eng": "a sheep with body covered in thick wool, sturdy legs with hooves, short tail, broad face, and small ears", + "eng_short": "a sheep", + "isCity": 0 + }, + { + "index": "120", + "folderName": "Tiger", + "zh": "老虎", + "eng": "a tiger with body covered in orange fur with black stripes, strong legs, a long black-tipped tail, and broad head shape", + "eng_short": "a tiger", + "isCity": 0 + }, + { + "index": "121", + "folderName": "Cattle", + "zh": "牛", + "eng": "a cattle with body covered in brown and white fur, small horns, strong legs with hooves, long tail, and broad head", + "eng_short": "a cattle", + "isCity": 0 + }, + { + "index": "122", + "folderName": "Giraffe", + "zh": "长颈鹿", + "eng": "a giraffe with body covered in tan fur with light brown patches, long neck, slender legs, and a pointed snout", + "eng_short": "a giraffe", + "isCity": 0 + }, + { + "index": "123", + "folderName": "GoldBettle", + "zh": "金色甲壳虫", + "eng": "a beetle with body covered in shiny green and blue exoskeleton, six slender legs, small antennae, and a smooth and rounded shell", + "eng_short": "a beetle", + "isCity": 0 + }, + { + "index": "124", + "folderName": "Gorilla", + "zh": "猿", + "eng": "a gorilla with body covered in gray fur, muscular build, long arms reaching the ground, broad chest, and a prominent face", + "eng_short": "a gorilla", + "isCity": 0 + }, + { + "index": "125", + "folderName": "HarpyEagle", + "zh": "角雕", + "eng": "a harpy eagle with body covered in dark blue and gray feathers, sharp yellow talons with black claws, and hooked beak", + "eng_short": "a harpy eagle", + "isCity": 0 + }, + { + "index": "126", + "folderName": "Hippopotamus", + "zh": "河马", + "eng": "a hippopotamus with body covered in thick brownish-gray skin, large rounded body, short legs with wide feet, and broad head", + "eng_short": "a hippopotamus", + "isCity": 0 + }, + { + "index": "127", + "folderName": "Hornet", + "zh": "大黄蜂", + "eng": "a hornet with body covered in shiny black and yellow exoskeleton, slender legs, transparent wings, long antennae, and a pointed stinger", + "eng_short": "a hornet", + "isCity": 0 + }, + { + "index": "128", + "folderName": "Iguana", + "zh": "鬣鳞蜥", + "eng": "an iguana with body covered in bright green scales, long tail, slender legs with sharp claws, spiny back crest, pointed snout", + "eng_short": "a iguana", + "isCity": 0 + }, + { + "index": "129", + "folderName": "Mosasaurus", + "zh": "沧龙", + "eng": "a mosasaurus with body covered in dark textured scales, long streamlined form, large tail fin, and flipper-like limbs", + "eng_short": "a mosasaurus", + "isCity": 0 + }, + { + "index": "130", + "folderName": "Orca", + "zh": "虎鲸", + "eng": "an orca with body covered in smooth black and white skin, large dorsal fin, rounded pectoral fins, streamlined body, and pointed snout", + "eng_short": "an orca", + "isCity": 0 + }, + { + "index": "131", + "folderName": "Penguin", + "zh": "企鹅", + "eng": "a penguin with body covered in black and white feathers, upright stance, flipper-like wings, webbed feet, and a pointed beak", + "eng_short": "a penguin", + "isCity": 0 + }, + { + "index": "132", + "folderName": "Frog", + "zh": "青蛙", + "eng": "a frog with vibrant blue skin covered in black spots, featuring long legs, webbed feet, large eyes, and a moist, smooth appearance", + "eng_short": "a frog", + "isCity": 0 + }, + { + "index": "133", + "folderName": "RedCrownedCrane", + "zh": "丹顶鹤", + "eng": "a crane with body covered in white feathers with black accents, long slender legs, long neck, pointed beak, and red crown", + "eng_short": "a crane", + "isCity": 0 + }, + { + "index": "134", + "folderName": "Secretarybird", + "zh": "蛇鹫", + "eng": "a secretary bird with body covered in pale gray feathers, slender legs, a crested head with orange face, and hooked beak", + "eng_short": "a secretary bird", + "isCity": 0 + }, + { + "index": "135", + "folderName": "SnowCrab", + "zh": "雪蟹", + "eng": "a snow crab with body covered in a beige shell, long spindly red legs, two front claws, small eyes", + "eng_short": "a snow crab", + "isCity": 0 + }, + { + "index": "136", + "folderName": "Swan", + "zh": "天鹅", + "eng": "a swan with body covered in white feathers, long curved neck, orange beak with black markings, and webbed feet", + "eng_short": "a swan", + "isCity": 0 + }, + { + "index": "137", + "folderName": "Tarantula", + "zh": "狼蛛", + "eng": "a tarantula with body covered in iridescent green and purple hairs, long segmented legs with black tips, and a shiny black abdomen", + "eng_short": "a tarantula", + "isCity": 0 + }, + { + "index": "138", + "folderName": "Turtle", + "zh": "乌龟", + "eng": "a turtle with body covered in a thick and textured shell, sturdy legs with scaly skin, long neck, a small and wrinkled head", + "eng_short": "a turtle", + "isCity": 0 + }, + { + "index": "139", + "folderName": "Goldfish", + "zh": "金鱼", + "eng": "a goldfish with body covered in shiny orange scales, large round eyes, translucent fins with dark edges, and a rounded and fan-like tail", + "eng_short": "a goldfish", + "isCity": 0 + }, + { + "index": "140", + "folderName": "Walrus", + "zh": "海象", + "eng": "a walrus with body covered in thick brown skin, large flippers, prominent long ivory tusks, whiskers around the mouth, and a rounded face", + "eng_short": "a walrus", + "isCity": 0 + }, + { + "index": "141", + "folderName": "Agen", + "zh": "阿根廷龙", + "eng": "a long-necked dinosaur with green, scaly skin, spines along its back, and a massive and elongated tail", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "142", + "folderName": "Ankylosaurus", + "zh": "甲龙", + "eng": "an Ankylosaurus with body covered in dark brown armored plates with gold-like bumps, heavy build, thick tail with a clubbed end", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "143", + "folderName": "BeiciZoupao", + "zh": "棘背龙", + "eng": "a Spinosaurus with body covered in light-colored scales, large sail-like spine on back, long tail, sharp claws, elongated snout", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "144", + "folderName": "Brontosaurus", + "zh": "雷龙", + "eng": "a Brontosaurus with body covered in dark brown scales with spots, long neck, large body, thick legs, and an extended tail", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "145", + "folderName": "Dragon", + "zh": "西方龙", + "eng": "a dinosaur with body covered in dark scales, large wings with webbed texture, sharp spines along its back, and long tail", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "147", + "folderName": "Parasaurolophus", + "zh": "副龙栉龙", + "eng": "a Parasaurolophus with brown-striped and white markings, slender limbs, long tail, and a prominent head crest", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "148", + "folderName": "Ptero", + "zh": "沙鸡龙", + "eng": "a Ptero with large wings, elongated beak, sharp teeth, clawed feet, and a pointed head crest", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "149", + "folderName": "Velociraptor", + "zh": "猛禽龙", + "eng": "a raptor-like dinosaur with dark brown, striped skin, sharp teeth, clawed feet, long tail, and fierce yellow eyes", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "150", + "folderName": "Stegosaurus", + "zh": "剑龙", + "eng": "a Stegosaurus with green-striped skin, red-orange back plates, spiked tail, and a bulky and four-legged body", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "151", + "folderName": "Stygi", + "zh": "暗脉龙", + "eng": "a horned dinosaur with grayish skin, multiple horns on its head, a long tail, and four strong legs", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "152", + "folderName": "TrexAnimated", + "zh": "霸王龙", + "eng": "a Tyrannosaurus rex-like dinosaur with tan and textured skin, short arms, powerful legs, sharp claws, and a muscular tail", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "153", + "folderName": "Tyranno", + "zh": "白色霸王龙", + "eng": "a dinosaur with gray, striped skin, muscular legs, small arms, and a head with red bony protrusions, resembling Carnotaurus", + "eng_short": "a dinosaur", + "isCity": 0 + }, + { + "index": "154", + "folderName": "Lufeng", + "zh": "迅猛龙", + "eng": "an agile dinosaur with tan and patterned skin, spiky back protrusions, long legs, clawed feet, a slender and crested head", + "eng_short": "a dinosaur", + "isCity": 0 + } + ] +} diff --git a/Hemi12_transforms.json b/Hemi12_transforms.json new file mode 100644 index 0000000000000000000000000000000000000000..b6ebc0ca81ddad6759acffeeacbfdde332615b4f --- /dev/null +++ b/Hemi12_transforms.json @@ -0,0 +1,14 @@ +{ + "C_01_35mm": "[-0.8622445326446021 -0.497817113029644 -0.09334070869305826 0] [0.49999999999999994 -0.8660254037844387 0.0 0] [-0.08083542493543144 -0.04667035434652912 0.9956342260592881 0] [692.820323027551 399.99999999999994 0.0 1]", + "C_02_35mm": "[-0.49781711302964426 -0.862244532644602 -0.09334070869305827 0] [0.8660254037844386 -0.5000000000000002 0.0 0] [-0.04667035434652916 -0.08083542493543144 0.9956342260592881 0] [400.0000000000001 692.8203230275509 0.0 1]", + "C_03_35mm": "[-1.6011019497192098e-16 -0.9956342260592881 -0.09334070869305827 0] [1.0 -1.6081226496766366e-16 0.0 0] [-1.5010330778617594e-17 -0.09334070869305827 0.9956342260592881 0] [4.898587196589413e-14 800.0 0.0 1]", + "C_04_35mm": "[0.49781711302964377 -0.8622445326446022 -0.09334070869305827 0] [0.8660254037844388 0.4999999999999997 0.0 0] [0.04667035434652911 -0.08083542493543147 0.9956342260592881 0] [-399.99999999999983 692.820323027551 0.0 1]", + "C_05_35mm": "[0.8622445326446021 -0.4978171130296439 -0.09334070869305826 0] [0.49999999999999983 0.8660254037844387 0.0 0] [0.08083542493543144 -0.046670354346529115 0.9956342260592881 0] [-692.820323027551 399.99999999999994 0.0 1]", + "C_06_35mm": "[0.9956342260592881 -1.2193002680650596e-16 -0.09334070869305827 0] [1.2246467991473532e-16 1.0 0.0 0] [0.09334070869305827 -1.1430940013109933e-17 0.9956342260592881 0] [-800.0 9.797174393178826e-14 0.0 1]", + "C_07_35mm": "[0.862244532644602 0.49781711302964415 -0.09334070869305827 0] [-0.5000000000000001 0.8660254037844386 0.0 0] [0.08083542493543144 0.04667035434652914 0.9956342260592881 0] [-692.8203230275509 -400.0000000000001 0.0 1]", + "C_08_35mm": "[0.4978171130296444 0.8622445326446019 -0.09334070869305827 0] [-0.8660254037844385 0.5000000000000003 0.0 0] [0.046670354346529164 0.08083542493543144 0.9956342260592881 0] [-400.00000000000034 -692.8203230275508 0.0 1]", + "C_09_35mm": "[2.820402217784269e-16 0.9956342260592881 -0.09334070869305827 0] [-1.0 2.83276944882399e-16 0.0 0] [2.6441270791727528e-17 0.09334070869305827 0.9956342260592881 0] [-1.4695761589768238e-13 -800.0 0.0 1]", + "C_10_35mm": "[-0.49781711302964426 0.862244532644602 -0.09334070869305827 0] [-0.8660254037844386 -0.5000000000000002 0.0 0] [-0.04667035434652916 0.08083542493543144 0.9956342260592881 0] [400.0000000000001 -692.8203230275509 0.0 1]", + "C_11_35mm": "[-0.8622445326446019 0.4978171130296444 -0.09334070869305827 0] [-0.5000000000000003 -0.8660254037844385 0.0 0] [-0.08083542493543144 0.046670354346529164 0.9956342260592881 0] [692.8203230275507 -400.00000000000034 0.0 1]", + "C_12_35mm": "[-0.9956342260592881 1.2193002680650596e-16 -0.09334070869305827 0] [-1.2246467991473532e-16 -1.0 0.0 0] [-0.09334070869305827 1.1430940013109933e-17 0.9956342260592881 0] [800.0 -1.9594348786357651e-13 0.0 1]" +} \ No newline at end of file diff --git a/RefPic/101.png b/RefPic/101.png new file mode 100644 index 0000000000000000000000000000000000000000..ed845fe30c5809c3daf605c413e1a670a85e133c --- /dev/null +++ b/RefPic/101.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d669cbce45aeddf7ab2c1b51f5b2d36201bfca42888f7d5c0ddf47848f4127d8 +size 194243 diff --git a/RefPic/102.png b/RefPic/102.png new file mode 100644 index 0000000000000000000000000000000000000000..064de2af8f3f9f706536afe6e9ecc12a2387d1f5 --- /dev/null +++ b/RefPic/102.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e7e54ecdbd2910597d8a4a64d9e9fac34f1842baa3bd3efcbe23f7294e1e404 +size 163781 diff --git a/RefPic/103.png b/RefPic/103.png new file mode 100644 index 0000000000000000000000000000000000000000..de83fd09bc83cdf72ddf47a9032d0ad4396e1b00 --- /dev/null +++ b/RefPic/103.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a1e22d215a7a430723b21149f13fc96264d0431989e2130324cd31c5e75b9d9 +size 128732 diff --git a/RefPic/104.png b/RefPic/104.png new file mode 100644 index 0000000000000000000000000000000000000000..89df6e25a23fe2a650cbd5e45291ace6acaf4c94 --- /dev/null +++ b/RefPic/104.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9f172a39bf7044e48dd844d3e9205c7e1e1d2635700796306eb2db2d9e2c9dd +size 319593 diff --git a/RefPic/105.png b/RefPic/105.png new file mode 100644 index 0000000000000000000000000000000000000000..3d94ff5b01863a97779e42be3ce30c3a421f5f41 --- /dev/null +++ b/RefPic/105.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88d4cc286297157cd7416602720ba84843b32fffb4d1c008b624b8ffbcff014b +size 356539 diff --git a/RefPic/107.png b/RefPic/107.png new file mode 100644 index 0000000000000000000000000000000000000000..c5fc92ea48df5735d867c1e000a63bd2b99135ac --- /dev/null +++ b/RefPic/107.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1164c3b718bb283a81c060e3fff1a3314830365d5852defb2aa75ab24110a1c7 +size 217487 diff --git a/RefPic/108.png b/RefPic/108.png new file mode 100644 index 0000000000000000000000000000000000000000..9f2d17990334dbf4f922c14a6de81b0fcb0827a5 --- /dev/null +++ b/RefPic/108.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c1e7b81cf1c437ec0d4f514cdb26285c7c6e31233be96af6a3d990d684b7e9d +size 400578 diff --git a/RefPic/109.png b/RefPic/109.png new file mode 100644 index 0000000000000000000000000000000000000000..6dd595a5f9fbe0c54fbb3bc45fc19db1a37a1eb0 --- /dev/null +++ b/RefPic/109.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:55d2baf29aebaffd7377be0557b5c6b06c6d4f56737d6c8336896685718db456 +size 371232 diff --git a/RefPic/110.png b/RefPic/110.png new file mode 100644 index 0000000000000000000000000000000000000000..13a88b1b11a065452b178fbfd8ecd8bfa3a676b2 --- /dev/null +++ b/RefPic/110.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e2d1d26c803dd553c220bf7683141b44bb6cdff2478f5f833d70bc1721b3ba4 +size 426345 diff --git a/RefPic/111.png b/RefPic/111.png new file mode 100644 index 0000000000000000000000000000000000000000..5f08b0bcb5994ab9d912aa679ff67a16c24cc44f --- /dev/null +++ b/RefPic/111.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5aa67296693ac0b227e4d8594335c9bd6e43236644bea6bb39eea7c20d0d18cd +size 314086 diff --git a/RefPic/112.png b/RefPic/112.png new file mode 100644 index 0000000000000000000000000000000000000000..45bc8e4348eaf02dcbdfa16d4fc02799e2c4d458 --- /dev/null +++ b/RefPic/112.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00d01fc2c67596c7cd01623db2078a4f8ec9790992bf7a1b8af2972fe1664c3f +size 376251 diff --git a/RefPic/113.png b/RefPic/113.png new file mode 100644 index 0000000000000000000000000000000000000000..770fd92f9aac5de7334d22b952e195b9bb4fb54f --- /dev/null +++ b/RefPic/113.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a301bdb1e91bc3c68942353811d84b3a59c9a3fe2f88ac6a8864ca7eaf0bcac7 +size 315978 diff --git a/RefPic/114.png b/RefPic/114.png new file mode 100644 index 0000000000000000000000000000000000000000..e6deb17cb41da6cbe717bf380cac5ec0456f4dfa --- /dev/null +++ b/RefPic/114.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad629c58ba772b42945d54c63342bafc0515686c5304adaa74f279a0c337500e +size 396899 diff --git a/RefPic/115.png b/RefPic/115.png new file mode 100644 index 0000000000000000000000000000000000000000..7f3dd258735fd9fe503b24ae24834850ac0e286f --- /dev/null +++ b/RefPic/115.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e10d1e0fa4ca0a1c6eaa7ab6b20e1c93d126374827a007bbea274b15bb4c908 +size 372399 diff --git a/RefPic/117.png b/RefPic/117.png new file mode 100644 index 0000000000000000000000000000000000000000..dd2a9ee2dc8c8e13f11dabd33f7eaf22614cf74d --- /dev/null +++ b/RefPic/117.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c5d1d852f95dc709beb557b5a0bfdcd0820d0e033aef3a1156674053dd417aa +size 237071 diff --git a/RefPic/119.png b/RefPic/119.png new file mode 100644 index 0000000000000000000000000000000000000000..cf0f37063e7705d472ed74a855e08e6b7697c999 --- /dev/null +++ b/RefPic/119.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a51b9f820a872ff2aa8ffeb67dc6ac6d6b5dc1ba7d2de0e3bf12c987e703ff79 +size 327079 diff --git a/RefPic/120.png b/RefPic/120.png new file mode 100644 index 0000000000000000000000000000000000000000..8932dce9a8348477395f7941d79f2c83437af70b --- /dev/null +++ b/RefPic/120.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8a8954acdf8ba77f67aafb11dafe1c3848a7d36bd2bf65fe973284ca5526b71 +size 375284 diff --git a/RefPic/121.png b/RefPic/121.png new file mode 100644 index 0000000000000000000000000000000000000000..651cb80ad432a2702fb4f5793b684a450de55107 --- /dev/null +++ b/RefPic/121.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15caa1274361f452ce7c7d8bd0cf256dc187bb5f4ce42ea955838123cf5a6f5e +size 350634 diff --git a/RefPic/122.png b/RefPic/122.png new file mode 100644 index 0000000000000000000000000000000000000000..d68a99efcd732908683525f710c59561c9af5a70 --- /dev/null +++ b/RefPic/122.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6f99039ddc21e61f3d6ea540cb6656572ab9431b2169385a0d5236d1d48fde0 +size 324895 diff --git a/RefPic/123.png b/RefPic/123.png new file mode 100644 index 0000000000000000000000000000000000000000..dc93712046a4f6a89f887279fec89872e212b2c7 --- /dev/null +++ b/RefPic/123.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aef72865b6162af0e6dcc6defa918d60eb991b006513c958a34df58fbd3a4712 +size 259116 diff --git a/RefPic/124.png b/RefPic/124.png new file mode 100644 index 0000000000000000000000000000000000000000..2ad05434d84d018475e8dca2bef212ee3d45cb86 --- /dev/null +++ b/RefPic/124.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4517ddec3db5ecf719d9c247fba03d60ce72ecee367930f3178fd58d7335892 +size 419172 diff --git a/RefPic/125.png b/RefPic/125.png new file mode 100644 index 0000000000000000000000000000000000000000..4314f6eba59ecb79103309d23e9c86030f31fc96 --- /dev/null +++ b/RefPic/125.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48349606b456548ba32e29b38559861456ca358d41b123dfa2a29814588ec608 +size 375708 diff --git a/RefPic/126.png b/RefPic/126.png new file mode 100644 index 0000000000000000000000000000000000000000..8f056075e1ac2fe21ec82810cab0afb38967ed53 --- /dev/null +++ b/RefPic/126.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6048d898bd48313c80a6113207852f16e0317358e5ae1125cd93660a590069cd +size 363765 diff --git a/RefPic/127.png b/RefPic/127.png new file mode 100644 index 0000000000000000000000000000000000000000..675d796fa6011c5bbdb123818af2af8134c6b210 --- /dev/null +++ b/RefPic/127.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e173fdd39860a9cdc6127ba97cea83a979728ae2078ae2ba8f7ed9801e075f7 +size 297003 diff --git a/RefPic/128.png b/RefPic/128.png new file mode 100644 index 0000000000000000000000000000000000000000..fc6f7a8557cc2b05e6193457c78f4691b8d7723c --- /dev/null +++ b/RefPic/128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8958efdb61bdfe545c6c3efd9839968ed71c2bf75be2ef410a5673fe0afbe9ba +size 325413 diff --git a/RefPic/129.png b/RefPic/129.png new file mode 100644 index 0000000000000000000000000000000000000000..940450f02ecd43f236578ec9e3259147cbe2e90c --- /dev/null +++ b/RefPic/129.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a9a387d841c4bced1e9a74c7f208ec5995499c0a65f4f3de8c9bc19bd3ae136 +size 302962 diff --git a/RefPic/130.png b/RefPic/130.png new file mode 100644 index 0000000000000000000000000000000000000000..6b3ff452c33034cf98e7d47a1763ce97ec8e0061 --- /dev/null +++ b/RefPic/130.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:753db2421875fa66deefed8b6bf3d612d496ab997a3f9c6bdb424fa86704cb34 +size 262627 diff --git a/RefPic/131.png b/RefPic/131.png new file mode 100644 index 0000000000000000000000000000000000000000..35bc6611b3b8db87d57e76ddd861055b352ee8fb --- /dev/null +++ b/RefPic/131.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f99d5cde3fece43a153f466620d18f786b25a7bda0c060296de49c092182d9cc +size 273011 diff --git a/RefPic/132.png b/RefPic/132.png new file mode 100644 index 0000000000000000000000000000000000000000..95e43517bb5bdd280e511c33dc9c2f7874c44ec5 --- /dev/null +++ b/RefPic/132.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:45b9e234697013a15f68dece37a087c1e33038c9fe6dc3ade92d8160b87e85e1 +size 312992 diff --git a/RefPic/133.png b/RefPic/133.png new file mode 100644 index 0000000000000000000000000000000000000000..42dd73aa8c5933de5bff32a63de1a491e1c2de0e --- /dev/null +++ b/RefPic/133.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13fcab8374bd5a32bdf6b2213f58ce7d208a0c5bc87e0fc15714a53b0d362efa +size 270593 diff --git a/RefPic/134.png b/RefPic/134.png new file mode 100644 index 0000000000000000000000000000000000000000..23471ee30bc27fe81d17e8cd3c2c84f25ff67d82 --- /dev/null +++ b/RefPic/134.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:558d2f7f1149c94c53a9901f627500345a04d2d2cd332cbc94b0e7728282cba8 +size 308635 diff --git a/RefPic/135.png b/RefPic/135.png new file mode 100644 index 0000000000000000000000000000000000000000..fca07174720fed4231328bcaee78afacfbadb0dc --- /dev/null +++ b/RefPic/135.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9aa54c8108c8382b9ff1b4818da6432779ca3e0d023f3991dfff3211bc08538b +size 327886 diff --git a/RefPic/136.png b/RefPic/136.png new file mode 100644 index 0000000000000000000000000000000000000000..3729a591ab79069392c7ec06fa3b77f6f526c397 --- /dev/null +++ b/RefPic/136.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae43235042df648e46a224de55ec19def92c826fea5dbc8c26b54656a3c8dfb1 +size 314974 diff --git a/RefPic/137.png b/RefPic/137.png new file mode 100644 index 0000000000000000000000000000000000000000..54748cc145488d38ca47bec94d0c41d013723f9d --- /dev/null +++ b/RefPic/137.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:074f25e236f353f795a6cea1167fef114f8f098ebac797ab8bbe0ceff3f1e486 +size 294327 diff --git a/RefPic/138.png b/RefPic/138.png new file mode 100644 index 0000000000000000000000000000000000000000..b8c87fce6192c58de4848dcddf30d993464332b4 --- /dev/null +++ b/RefPic/138.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b4e0bcd429b7f579ec01d26a75f624b693925d15039f95457533bc5ea522f60 +size 335717 diff --git a/RefPic/139.png b/RefPic/139.png new file mode 100644 index 0000000000000000000000000000000000000000..92043eeb42342656d4c6226887bce9581e507eb4 --- /dev/null +++ b/RefPic/139.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7977daf29b39de4d326ba04381c102a4483613b0cc654f97b87bdfde00d182f +size 368330 diff --git a/RefPic/140.png b/RefPic/140.png new file mode 100644 index 0000000000000000000000000000000000000000..ef9f6857052c7cec901a17860733b6c0d242e8b2 --- /dev/null +++ b/RefPic/140.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67b9ffe1bec8ab384843f1638942208ef993a9ccf1abda711ce52017e2d75d2b +size 321834 diff --git a/RefPic/141.jpg b/RefPic/141.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ae4604da83cbf4ab3658e766878831bec8043492 --- /dev/null +++ b/RefPic/141.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2030f0dc4dbd8a7e03afac3067feb4dfdaf50836b53db60565ef0939e85ee8b +size 335652 diff --git a/RefPic/142.png b/RefPic/142.png new file mode 100644 index 0000000000000000000000000000000000000000..59eb6f70cb71cf104387f07576c86f7ce91a3bd5 --- /dev/null +++ b/RefPic/142.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b749eada1b2f3598b8374c66f374a9376c65cad370945b7d7ffbfdf673e01b0 +size 377880 diff --git a/RefPic/143.png b/RefPic/143.png new file mode 100644 index 0000000000000000000000000000000000000000..2f36a05f7e159512572248bd8c16af0a94730efe --- /dev/null +++ b/RefPic/143.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbcb69ef66ea7446a46b149e553ad07aaa1ad3dc1e0923917e4c6a53c2aea3b7 +size 360376 diff --git a/RefPic/144.png b/RefPic/144.png new file mode 100644 index 0000000000000000000000000000000000000000..17ec68835108e2faf08b1e65385586499cfb719f --- /dev/null +++ b/RefPic/144.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc0a5e98da8a365c71f0746e3d0d93b0a9cc3e9a904f77b0fc8e382a9e4f5c03 +size 345202 diff --git a/RefPic/145.png b/RefPic/145.png new file mode 100644 index 0000000000000000000000000000000000000000..9825b0a624162f6db726e941edbecf9d4c583c09 --- /dev/null +++ b/RefPic/145.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8087049c42289eac6d2c24d0290fa25665d96062d8b2019cd74f5db582e9303a +size 401945 diff --git a/RefPic/147.png b/RefPic/147.png new file mode 100644 index 0000000000000000000000000000000000000000..40cff657d6f709572e5902873ff097c39f03ae49 --- /dev/null +++ b/RefPic/147.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc04f147c705230c24d12228d4553a13e84055444d1378af7578a320f1eb5196 +size 446929 diff --git a/RefPic/148.png b/RefPic/148.png new file mode 100644 index 0000000000000000000000000000000000000000..5c110aa4914f3e42a82553713da0b6f746a3ae36 --- /dev/null +++ b/RefPic/148.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d50ad9871b1c1f07e8a4b2235950756dd0616a07f7722bf6336a3a4dfba4a16 +size 327710 diff --git a/RefPic/149.png b/RefPic/149.png new file mode 100644 index 0000000000000000000000000000000000000000..618d4914efe7bfece502967101aae36badba67fb --- /dev/null +++ b/RefPic/149.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b6e9bb07cd84c6c21c62fe7a132806d3ac8082bc05fb8950ccfc447ae2a8e1c +size 447082 diff --git a/RefPic/150.png b/RefPic/150.png new file mode 100644 index 0000000000000000000000000000000000000000..2b43c45a220dd4ada752488d1fb6f74346294766 --- /dev/null +++ b/RefPic/150.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0cbd5ca1397f752d8c4dbd73019020b7583169187a67a047a295858d6d831b8 +size 408967 diff --git a/RefPic/151.png b/RefPic/151.png new file mode 100644 index 0000000000000000000000000000000000000000..c67442bf7f9ff27f73afefed5ad275dc658146ec --- /dev/null +++ b/RefPic/151.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07da82f16a7babbc49f222500ca5625de94219b9e8e24639b8b8a2e954fa19b4 +size 133371 diff --git a/RefPic/152.png b/RefPic/152.png new file mode 100644 index 0000000000000000000000000000000000000000..a02482028a25b159ab2e7f0938c336f883e0ce22 --- /dev/null +++ b/RefPic/152.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:280d437c6c72cf163aa9beb90af8e9fc688f4e1ca0576d7a739ab6989243fc7b +size 406974 diff --git a/RefPic/153.png b/RefPic/153.png new file mode 100644 index 0000000000000000000000000000000000000000..327215229d591081a30a18b9612f328d6c3d7b41 --- /dev/null +++ b/RefPic/153.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:057d3ea08847c382818f63721ad63fe346e49b94f0007ecb610b02f0b4404eaf +size 375186 diff --git a/RefPic/154.png b/RefPic/154.png new file mode 100644 index 0000000000000000000000000000000000000000..7af08d800d70c971518e7b9555212edb2c7e1c74 --- /dev/null +++ b/RefPic/154.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c57e22461e0cf2a91c193d6c75f1d4dec4a0935893a21e96ee6f87fc1e317b8 +size 315463 diff --git a/load_dataset.py b/load_dataset.py new file mode 100644 index 0000000000000000000000000000000000000000..5bb3981ed564e6464ba6906998f62bc008ad42bc --- /dev/null +++ b/load_dataset.py @@ -0,0 +1,156 @@ +# Copyright 2024 Xiao Fu, CUHK, Kuaishou Tech. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# -------------------------------------------------------------------------- +# If you find this code useful, we kindly ask you to cite our paper in your work. +# More information about the method can be found at http://fuxiao0719.github.io/projects/3dtrajmaster +# -------------------------------------------------------------------------- + +import os +import numpy as np +import json +import torch +import random +import cv2 +import decord +from einops import rearrange +from utils import * + +# -------------------------------------------------------------------------- +# 1. Load scenes infomation +# -------------------------------------------------------------------------- +dataset_root = 'root_path/360Motion-Dataset' +video_names = [] +scenes = ['Desert', 'HDRI'] +scene_location_pair = { + 'Desert' : 'desert', + 'HDRI' : + { + 'loc1' : 'snowy street', + 'loc2' : 'park', + 'loc3' : 'indoor open space', + 'loc11' : 'gymnastics room', + 'loc13' : 'autumn forest', + } +} +for scene in scenes: + video_path = os.path.join(dataset_root, scene) + locations_path = os.path.join(video_path, "location_data.json") + with open(locations_path, 'r') as f: locations = json.load(f) + locations_info = {locations[idx]['name']:locations[idx] for idx in range(len(locations))} + for video_name in os.listdir(video_path): + if video_name.endswith('Hemi12_1') == True: + if scene != 'HDRI': + location = scene_location_pair[scene] + else: + location = scene_location_pair['HDRI'][video_name.split('_')[1]] + video_names.append((scene, video_name, location, locations_info)) + +# -------------------------------------------------------------------------- +# 2. Load 12 surrounding cameras +# -------------------------------------------------------------------------- +cam_num = 12 +max_objs_num = 3 +length = len(video_names) +captions_path = os.path.join(dataset_root, "CharacterInfo.json") +with open(captions_path, 'r') as f: captions = json.load(f)['CharacterInfo'] +captions_info = {int(captions[idx]['index']):captions[idx]['eng'] for idx in range(len(captions))} +cams_path = os.path.join(dataset_root, "Hemi12_transforms.json") +with open(cams_path, 'r') as f: cams_info = json.load(f) +cam_poses = [] +for i, key in enumerate(cams_info.keys()): + if "C_" in key: + cam_poses.append(parse_matrix(cams_info[key])) +cam_poses = np.stack(cam_poses) +cam_poses = np.transpose(cam_poses, (0,2,1)) +cam_poses = cam_poses[:,:,[1,2,0,3]] +cam_poses[:,:3,3] /= 100. +cam_poses = cam_poses +sample_n_frames = 49 + +# -------------------------------------------------------------------------- +# 3. Load a sample of video & object poses +# -------------------------------------------------------------------------- +(scene, video_name, location, locations_info) = video_names[20] + +with open(os.path.join(dataset_root, scene, video_name, video_name+'.json'), 'r') as f: objs_file = json.load(f) +objs_num = len(objs_file['0']) +video_index = random.randint(1, cam_num-1) + +location_name = video_name.split('_')[1] +location_info = locations_info[location_name] +cam_pose = cam_poses[video_index-1] +obj_transl = location_info['coordinates']['CameraTarget']['position'] + +prompt = '' +video_caption_list = [] +obj_poses_list = [] + +for obj_idx in range(objs_num): + + obj_name_index = objs_file['0'][obj_idx]['index'] + video_caption = captions_info[obj_name_index] + + if video_caption.startswith(" "): + video_caption = video_caption[1:] + if video_caption.endswith("."): + video_caption = video_caption[:-1] + video_caption = video_caption.lower() + video_caption_list.append(video_caption) + + obj_poses = load_sceneposes(objs_file, obj_idx, obj_transl) + obj_poses = np.linalg.inv(cam_pose) @ obj_poses + obj_poses_list.append(obj_poses) + +for obj_idx in range(objs_num): + video_caption = video_caption_list[obj_idx] + if obj_idx == objs_num - 1: + if objs_num == 1: + prompt += video_caption + ' is moving in the ' + location + else: + prompt += video_caption + ' are moving in the ' + location + else: + prompt += video_caption + ' and ' + +obj_poses_all = torch.from_numpy(np.array(obj_poses_list)) + +total_frames = 99 +current_sample_stride = 1.75 +cropped_length = int(sample_n_frames * current_sample_stride) +start_frame_ind = random.randint(10, max(10, total_frames - cropped_length - 1)) +end_frame_ind = min(start_frame_ind + cropped_length, total_frames) +frame_indices = np.linspace(start_frame_ind, end_frame_ind - 1, sample_n_frames, dtype=int) + +video_frames_path = os.path.join(dataset_root, scene, video_name, 'videos', video_name+ f'_C_{video_index:02d}_35mm.mp4') +cap = cv2.VideoCapture(video_frames_path) +height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) +width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) + +# get local rank +ctx = decord.cpu(0) +reader = decord.VideoReader(video_frames_path, ctx=ctx, height=height, width=width) +assert len(reader) == total_frames or len(reader) == total_frames+1 +frame_indexes = [frame_idx for frame_idx in range(total_frames)] +try: + video_chunk = reader.get_batch(frame_indexes).asnumpy() +except: + video_chunk = reader.get_batch(frame_indexes).numpy() + +pixel_values = np.array([video_chunk[indice] for indice in frame_indices]) +pixel_values = rearrange(torch.from_numpy(pixel_values) / 255.0, "f h w c -> f c h w") + +save_video = True +if save_video: + video_data = (pixel_values.cpu().to(torch.float32).numpy() * 255).astype(np.uint8) + video_data = rearrange(video_data, "f c h w -> f h w c") + save_images2video(video_data, video_name, 12) diff --git a/utils.py b/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..84e258f45b555f69b7d45f4519de7bb6e9555402 --- /dev/null +++ b/utils.py @@ -0,0 +1,151 @@ +# Copyright 2024 Xiao Fu, CUHK, Kuaishou Tech. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# -------------------------------------------------------------------------- +# If you find this code useful, we kindly ask you to cite our paper in your work. +# More information about the method can be found at http://fuxiao0719.github.io/projects/3dtrajmaster +# -------------------------------------------------------------------------- +import os +import numpy as np +from io import BytesIO +import imageio.v2 as imageio +import open3d +import math +from tools.vis_cam import get_camera_frustum, frustums2lineset +import trimesh + +def parse_matrix(matrix_str): + rows = matrix_str.strip().split('] [') + matrix = [] + for row in rows: + row = row.replace('[', '').replace(']', '') + matrix.append(list(map(float, row.split()))) + return np.array(matrix) + +def load_sceneposes(objs_file, obj_idx, obj_transl): + ext_poses = [] + for i, key in enumerate(objs_file.keys()): + ext_poses.append(parse_matrix(objs_file[key][obj_idx]['matrix'])) + ext_poses = np.stack(ext_poses) + ext_poses = np.transpose(ext_poses, (0,2,1)) + ext_poses[:,:3,3] -= obj_transl + ext_poses[:,:3,3] /= 100. + ext_poses = ext_poses[:, :, [1,2,0,3]] + return ext_poses + +def save_images2video(images, video_name, fps): + fps = fps + format = "mp4" + codec = "libx264" + ffmpeg_params = ["-crf", str(12)] + pixelformat = "yuv420p" + video_stream = BytesIO() + + with imageio.get_writer( + video_stream, + fps=fps, + format=format, + codec=codec, + ffmpeg_params=ffmpeg_params, + pixelformat=pixelformat, + ) as writer: + for idx in range(len(images)): + writer.append_data(images[idx]) + + video_data = video_stream.getvalue() + + output_path = os.path.join(video_name + ".mp4") + with open(output_path, "wb") as f: + f.write(video_data) + +def normalize(x): + return x / np.linalg.norm(x) + +def viewmatrix(z, up, pos): + vec2 = normalize(z) + vec1_avg = up + vec0 = normalize(np.cross(vec1_avg, vec2)) + vec1 = normalize(np.cross(vec2, vec0)) + m = np.stack([vec0, vec1, vec2, pos], 1) + return m + +def matrix_to_euler_angles(matrix): + sy = math.sqrt(matrix[0][0] * matrix[0][0] + matrix[1][0] * matrix[1][0]) + singular = sy < 1e-6 + + if not singular: + x = math.atan2(matrix[2][1], matrix[2][2]) + y = math.atan2(-matrix[2][0], sy) + z = math.atan2(matrix[1][0], matrix[0][0]) + else: + x = math.atan2(-matrix[1][2], matrix[1][1]) + y = math.atan2(-matrix[2][0], sy) + z = 0 + + return math.degrees(x), math.degrees(y), math.degrees(z) + +def eul2rot(theta) : + + R = np.array([[np.cos(theta[1])*np.cos(theta[2]), np.sin(theta[0])*np.sin(theta[1])*np.cos(theta[2]) - np.sin(theta[2])*np.cos(theta[0]), np.sin(theta[1])*np.cos(theta[0])*np.cos(theta[2]) + np.sin(theta[0])*np.sin(theta[2])], + [np.sin(theta[2])*np.cos(theta[1]), np.sin(theta[0])*np.sin(theta[1])*np.sin(theta[2]) + np.cos(theta[0])*np.cos(theta[2]), np.sin(theta[1])*np.sin(theta[2])*np.cos(theta[0]) - np.sin(theta[0])*np.cos(theta[2])], + [-np.sin(theta[1]), np.sin(theta[0])*np.cos(theta[1]), np.cos(theta[0])*np.cos(theta[1])]]) + + return R.T + +def extract_location_rotation(data): + results = {} + for key, value in data.items(): + matrix = parse_matrix(value) + location = np.array([matrix[3][0], matrix[3][1], matrix[3][2]]) + rotation = eul2rot(matrix_to_euler_angles(matrix)) + transofmed_matrix = np.identity(4) + transofmed_matrix[:3,3] = location + transofmed_matrix[:3,:3] = rotation + results[key] = transofmed_matrix + return results + +def get_cam_points_vis(W, H, intrinsics, ext_pose, color,frustum_length): + cam = get_camera_frustum((W, H), intrinsics, np.linalg.inv(ext_pose), frustum_length=frustum_length, color=[0., 0., 1.]) + cam_points = cam[0] + for item in cam[1]: + cam_points = np.concatenate((cam_points, np.linspace(cam[0][item[0]], cam[0][item[1]], num=1000, endpoint=True, retstep=False, dtype=None))) + cam_points[:,0]*=-1 + cam_points = trimesh.points.PointCloud(vertices = cam_points, colors=[0, 255, 0, 255]) + cam_points_vis = open3d.geometry.PointCloud() + cam_points_vis.points = open3d.utility.Vector3dVector(cam_points) + cam_points_vis.paint_uniform_color(color) + return cam_points_vis + +def batch_axis_angle_to_rotation_matrix(r_batch): + batch_size = r_batch.shape[0] + rotation_matrices = [] + + for i in range(batch_size): + r = r_batch[i] + theta = np.linalg.norm(r) + if theta == 0: + rotation_matrices.append(np.eye(3)) + else: + k = r / theta + kx, ky, kz = k + + K = np.array([ + [0, -kz, ky], + [kz, 0, -kx], + [-ky, kx, 0] + ]) + + R = np.eye(3) + np.sin(theta) * K + (1 - np.cos(theta)) * np.dot(K, K) + rotation_matrices.append(R) + + return np.array(rotation_matrices) \ No newline at end of file