lambdaloop / anipose

🐜🐀🐒🚶 A toolkit for robust markerless 3D pose estimation
http://anipose.org
BSD 2-Clause "Simplified" License
351 stars 66 forks source link

Calibration Video Suggestion #52

Open KenR22 opened 3 years ago

KenR22 commented 3 years ago

Hi,

I was wondering if the board needs to be in videos in all of the cameras all the time. My setup has 4 cameras in 4 corners of a square area. So, it is not possible to have the boards projected on all the cameras for calibration.

I was also wondering if this is leading me to the error below:

D:\workspac_deepcut\local_DLC\FN 10-02-2020 - Short Clip-Chrissy-2020-10-08\videos\anipose_test\test1\calibration\calibrate1_cam2.mp4 99%|███████████████████████████▋| 3917/3960 [01:30<00:00, 356.40it/s][h264 @ 000002b22675ca80] Invalid NAL unit size (19244 > 789). [h264 @ 000002b22675ca80] Error splitting the input into NAL units. 99%|████████████████████████████▊| 3934/3960 [01:30<00:00, 43.41it/s] 562 boards detected D:\workspac_deepcut\local_DLC\FN 10-02-2020 - Short Clip-Chrissy-2020-10-08\videos\anipose_test\test1\calibration\calibrate1_cam5.mp4 100%|█████████████████████████████| 3960/3960 [01:00<00:00, 65.21it/s] 435 boards detected defaultdict(<class 'int'>, {('2', '5'): 1, ('5', '2'): 1}) Traceback (most recent call last): File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\rahmank\AppData\Local\Continuum\anaconda3\envs\anipose\Scripts\anipose.exe__main.py", line 7, in File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\click\core.py", line 829, in call__ return self.main(args, kwargs) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\click\core.py", line 782, in main rv = self.invoke(ctx) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\click\core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\click\core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\click\core.py", line 610, in invoke return callback(args, kwargs) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\click\decorators.py", line 73, in new_func return ctx.invoke(f, obj, *args, *kwargs) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\click\core.py", line 610, in invoke return callback(args, kwargs) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\anipose\anipose.py", line 115, in calibrate calibrate_all(config) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\anipose\common.py", line 168, in fun return process_all(config, process_session, args) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\anipose\common.py", line 125, in process_all output[()] = process_session(config, pipeline_prefix, args) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\anipose\calibrate.py", line 187, in process_session verbose=True) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\aniposelib\cameras.py", line 1560, in calibrate_rows rvecs, tvecs = get_initial_extrinsics(rtvecs) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\aniposelib\utils.py", line 173, in get_initial_extrinsics pairs = find_calibration_pairs(graph, source=0) File "c:\users\rahmank\appdata\local\continuum\anaconda3\envs\anipose\lib\site-packages\aniposelib\utils.py", line 156, in find_calibration_pairs for new in graph[item]: TypeError: 'NoneType' object is not subscriptable

My config toml is given below:

project = 'anipose_test'

model_folder = '../../../'

nesting = 0 video_extension = 'mp4'

[manual_verification]

true / false

manually_verify = true

[calibration]

checkerboard / charuco / aruco

board_type = "charuco"

width and height of grid

board_size = [10, 7]

number of bits in the markers, if aruco/charuco

board_marker_bits = 4

number of markers in dictionary, if aruco/charuco

board_marker_dict_number = 50

length of marker side

board_marker_length = 18.75 # mm

If aruco, length of marker separation

board_marker_separation_length = 1 # mm

If charuco or checkerboard, square side length

board_square_side_length = 25 # mm

animal_calibration = false

fisheye = true

[labeling] scheme = [

]

[triangulation] triangulate = true cam_regex = '_cam([0-9])' cam_align = "1" ransac = true optim = true constraints = [

] scale_smooth = 25 scale_length = 10 scale_length_weak = 2 reproj_error_threshold = 3 score_threshold = 0.6 n_deriv_smooth = 2

Settings for a threshold filter

Removes data outside threshold (probably errors in tracking), and interpolates

[filter] enabled = true medfilt = 9 # length of median filter offset_threshold = 25 # offset from median filter to count as jump score_threshold = 0.8 # score below which to count as bad spline = true # interpolate using cubic spline instead of linear

Thank you for your help.

ZiyiZhang0912 commented 3 years ago

Did you solve this problem? I currently have the same problem. How to calibrate the cameras on the opposite side at the same time?

KenR22 commented 3 years ago

I think you need to have the board projecting on at least two cameras at the same time. That is how I solved mine.

lambdaloop commented 3 years ago

Yeah, we've been rotating the board so it's visible in two cameras at the same time, like @KenR22 said. You can often tilt it forward and backwards at angle even when cameras are opposite to get them to see it.

It really is not ideal, and I would like to eventually add wand calibration to anipose, but i'm not sure when it will happen

roaldarbol commented 3 years ago

@lambdaloop Would just like to +1 for your wish to add wand calibration. Although I know time is probably a limited resource, it would really make markerless tracking in human biomechanics studies much more feasible. And the value Anipose would add to a field that relies heavily on super expensive rigs would be tremendous. Anyways, thanks for all the great work on this!