We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The transforms file contains the following: { "camera_angle_x": 0.6911112070083618, "frames": [ { "file_path": "train\1", "transform_matrix": [ [ -0.6737591624259949, -0.06633138656616211, -0.7359680533409119, -3.2077853679656982 ], [ -1.689766193635478e-08, 0.9959630370140076, -0.08976423740386963, -0.39124584197998047 ], [ 0.7389511466026306, -0.060479454696178436, -0.6710392236709595, -2.9247865676879883 ], [ 0.0, 0.0, 0.0, 1.0 ] ] }, I looked at your code and it doesn't have functionality to handle this.
The text was updated successfully, but these errors were encountered:
def load_transform_json_data(input_path, skip_rate=0): """ Load in poses and camera intrinsics from a transforms JSON file """
with open(input_path, "r") as transform_file: transforms = json.load(transform_file) json_transforms = {} intrinsics = {} all_intrinsics = None if "fl_x" in transforms.keys(): all_intrinsics = get_transform_intrinsics(transforms, transforms["frames"][0]["file_path"]) for i, frame in enumerate(transforms["frames"]): fname = os.path.basename(frame["file_path"]) transform = frame["transform_matrix"] if all_intrinsics is None: intrinsics[fname] = get_transform_intrinsics(frame, frame["file_path"]) else: intrinsics[fname] = all_intrinsics if i % (skip_rate + 1) == 0: json_transforms[fname] = transform return json_transforms, intrinsics
def get_transform_intrinsics(transforms, fname): """ Reads in camera intrinsics from a transforms dictionary """
intrinsics = [0, 0, 0, 0] intrinsics[2] = transforms["fl_x"] if "fl_y" in transforms.keys(): intrinsics[3] = transforms["fl_y"] else: # Assuming that focal lengths are same in both dimensions intrinsics[3] = intrinsics[2] if "w" in transforms and "h" in transforms: intrinsics[0] = transforms["w"] intrinsics[1] = transforms["h"] else: img_pixels = cv2.imread(fname) intrinsics[0] = img_pixels.shape[1] intrinsics[1] = img_pixels.shape[0] return intrinsics
Sorry, something went wrong.
No branches or pull requests
The transforms file
contains the following:
{
"camera_angle_x": 0.6911112070083618,
"frames": [
{
"file_path": "train\1",
"transform_matrix": [
[
-0.6737591624259949,
-0.06633138656616211,
-0.7359680533409119,
-3.2077853679656982
],
[
-1.689766193635478e-08,
0.9959630370140076,
-0.08976423740386963,
-0.39124584197998047
],
[
0.7389511466026306,
-0.060479454696178436,
-0.6710392236709595,
-2.9247865676879883
],
[
0.0,
0.0,
0.0,
1.0
]
]
},
I looked at your code and it doesn't have functionality to handle this.
The text was updated successfully, but these errors were encountered: