Thief of Wealth
Published 2020. 1. 7. 10:16
영상 보간법(Interpolation) 개발/Python

# INTERPOLATION MODE (filename, mode, start frame, end frame, body part)
if mode == 'I':
start_frame = int( reference_frame.split("+")[0] )
end_frame = int(reference_frame.split("+")[1])
for f in range(start_frame, end_frame + 1):
interpolate(body_info[start_frame - 1][b], body_info[end_frame + 1][b], body_info[f][b],
(f - start_frame) / (end_frame - start_frame), BODY_PART[body])

 

def interpolate(begin, end, out, step, part):

# 3D location of the joint j
for j in part:
out["joints"][j]["x"] = begin["joints"][j]["x"] + (end["joints"][j]["x"] - begin["joints"][j]["x"]) * step
out["joints"][j]["y"] = begin["joints"][j]["y"] + (end["joints"][j]["y"] - begin["joints"][j]["y"]) * step
out["joints"][j]["z"] = begin["joints"][j]["z"] + (end["joints"][j]["z"] - begin["joints"][j]["z"]) * step

# 2D location of the joint j in corresponding depth frame
for j in part:
out["joints"][j]["depthX"] = begin["joints"][j]["depthX"] + (end["joints"][j]["depthX"] - begin["joints"][j]["depthX"]) * step
out["joints"][j]["depthY"] = begin["joints"][j]["depthY"] + (end["joints"][j]["depthY"] - begin["joints"][j]["depthY"]) * step

'개발 > Python' 카테고리의 다른 글

MAC Selenium Firefox사용법  (0) 2020.04.28
Python autocomplete  (0) 2020.04.12
jupyter notebook 원격접속하기  (0) 2019.10.12
kaggle output file 다운 받기  (0) 2019.08.09
Python 고유 디버거 Pdb 사용하기  (0) 2019.07.27
profile on loading

Loading...