-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
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
FRAMES parameter is not an INT #351
Comments
Dear @Jack-Development I suspect that you are using a C3D which was constructed by some company I did not have a C3D file from to perform test. I could make a patch, but I would need an actual C3D file. If it is okay for you, you can send one to me via mail. That said, the FRAME must be an integer even though they decided to store it as a floating point, otherwise this c3d will be ill-formed. |
Hi @pariterre |
Dear @Jack-Development I forgot earlier, but the problem you refer to was actually already patch. As a result, the file you sent me open just fine on my computer. What version of ezc3d are you using? The current version is 1.5.17. I suggest to update if it is not already done :) |
Hi @pariterre Running it without the conda environment, I am able to load the c3d, but am given an incorrect frame length of 39 frames, as opposed to the 72,500+ frames and an error of "c3d['parameters']['POINT']['LABELSX']' must have the same length as nPoints of the data." Do you have any idea of the root cause of this? I am attempting to crop the video between two frames, do you have any example scripts for this? |
Hi @pariterre def crop_c3d(file_path, start_frame, end_frame):
# Read the c3d file
c3d = ezc3d.c3d(file_path)
c3d["data"]["points"] = c3d["data"]["points"][:, :, start_frame:end_frame + 1]
del c3d["data"]["meta_points"] # Let ezc3d do the job for the meta_points
c3d["header"]["points"]["first_frame"] = start_frame
c3d["header"]["points"]["last_frame"] = end_frame
c3d["parameters"]["ANALOG"]["UNITS"]["value"] = []
# Save the modified file with "_cropped" added to the original file name
base, ext = os.path.splitext(file_path)
new_file_path = f"{base}_cropped{ext}"
c3d.write(new_file_path)
if __name__ == "__main__":
if len(sys.argv) != 4:
print("Usage: python crop_c3d.py <file_path> <start_frame> <end_frame>")
sys.exit(1)
file_path = sys.argv[1]
start_frame = int(sys.argv[2])
end_frame = int(sys.argv[3])
crop_c3d(file_path, start_frame, end_frame) However, upon attempting to load the c3d file and check the length: def get_frame_length(c3d_file_path):
print("Loading file " + c3d_file_path)
c3d = ezc3d.c3d(c3d_file_path)
print("C3D file loaded.")
frame_length = c3d['header']['points']['last_frame'] - c3d['header']['points']['first_frame'] + 1
print("Frame length calculated.")
return frame_length
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python test_c3d.py <c3d_file_path>")
sys.exit(1)
c3d_file_path = sys.argv[1]
frame_length = get_frame_length(c3d_file_path)
print(f"Frame length: {frame_length}") I am getting a Segmentation Fault, even when the file is not even modified and just saved, it is unable to be loaded again by the ezc3d library, simply showing as a Segmentation Fault. def crop_c3d(file_path, start_frame, end_frame):
# Read the c3d file
c3d = ezc3d.c3d(file_path)
base, ext = os.path.splitext(file_path)
new_file_path = f"{base}_cropped{ext}"
c3d.write(new_file_path)
return |
Hi @Jack-Development |
The updated version was pushed to PyPI, please confirm your C3D can properly be read :) |
@Jack-Development |
@pariterre |
When running the file with a file-path input, it is unable to load the file with the error of "ValueError: FRAMES parameter is not an INT"
Works:
Doesn't Work:
Here is the exception log:
Wondered if you had any ideas on what was causing this, as it seems to work fine for everyone else?
The text was updated successfully, but these errors were encountered: