feat: move_camera.txt 支持 all 关键词表示全程执行
在帧位置写 all 表示该段对所有帧生效: all vx=0.1 ry=0.5 # 全程缓慢平移 + 旋转 等同于 start=0, end=INF,与普通区间段一样支持时间交叠。
This commit is contained in:
+8
-5
@@ -108,11 +108,14 @@ def _load_camera_motion(path):
|
|||||||
line = line.strip()
|
line = line.strip()
|
||||||
if not line or line.startswith("#"):
|
if not line or line.startswith("#"):
|
||||||
continue
|
continue
|
||||||
# 解析帧范围
|
# 解析帧范围:支持 "all"(全程)或 "N-M"(区间)
|
||||||
m = re.match(r'(\d+)\s*-\s*(\d+)', line)
|
if line.lower().startswith("all") or re.match(r'^\s*all\s', line, re.IGNORECASE):
|
||||||
if not m:
|
start, end = 0, 10**9
|
||||||
continue
|
else:
|
||||||
start, end = int(m.group(1)), int(m.group(2))
|
m = re.match(r'(\d+)\s*-\s*(\d+)', line)
|
||||||
|
if not m:
|
||||||
|
continue
|
||||||
|
start, end = int(m.group(1)), int(m.group(2))
|
||||||
v = [0.0, 0.0, 0.0]
|
v = [0.0, 0.0, 0.0]
|
||||||
r = [0.0, 0.0, 0.0]
|
r = [0.0, 0.0, 0.0]
|
||||||
# 解析 vx=, vy=, vz=
|
# 解析 vx=, vy=, vz=
|
||||||
|
|||||||
@@ -570,10 +570,14 @@ def _load_move_camera_txt():
|
|||||||
line = line.strip()
|
line = line.strip()
|
||||||
if not line or line.startswith("#"):
|
if not line or line.startswith("#"):
|
||||||
continue
|
continue
|
||||||
m = _re.match(r'(\d+)\s*-\s*(\d+)', line)
|
# 解析帧范围:支持 "all"(全程)或 "N-M"(区间)
|
||||||
if not m:
|
if line.lower().startswith("all") or _re.match(r'^\s*all\s', line, _re.IGNORECASE):
|
||||||
continue
|
start, end = 0, 10**9 # 用极大值表示全程
|
||||||
start, end = int(m.group(1)), int(m.group(2))
|
else:
|
||||||
|
m = _re.match(r'(\d+)\s*-\s*(\d+)', line)
|
||||||
|
if not m:
|
||||||
|
continue
|
||||||
|
start, end = int(m.group(1)), int(m.group(2))
|
||||||
v, r = [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]
|
v, r = [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]
|
||||||
for i, axis in enumerate(['x', 'y', 'z']):
|
for i, axis in enumerate(['x', 'y', 'z']):
|
||||||
m2 = _re.search(r'v' + axis + r'\s*=\s*([-\d.]+)', line)
|
m2 = _re.search(r'v' + axis + r'\s*=\s*([-\d.]+)', line)
|
||||||
|
|||||||
+8
-4
@@ -50,10 +50,14 @@ def _load_camera_kf(config, runtime_base):
|
|||||||
line = line.strip()
|
line = line.strip()
|
||||||
if not line or line.startswith("#"):
|
if not line or line.startswith("#"):
|
||||||
continue
|
continue
|
||||||
m = re.match(r'(\d+)\s*-\s*(\d+)', line)
|
# 解析帧范围:支持 "all"(全程)或 "N-M"(区间)
|
||||||
if not m:
|
if line.lower().startswith("all") or re.match(r'^\s*all\s', line, re.IGNORECASE):
|
||||||
continue
|
start, end = 0, 10**9
|
||||||
start, end = int(m.group(1)), int(m.group(2))
|
else:
|
||||||
|
m = re.match(r'(\d+)\s*-\s*(\d+)', line)
|
||||||
|
if not m:
|
||||||
|
continue
|
||||||
|
start, end = int(m.group(1)), int(m.group(2))
|
||||||
v, r = [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]
|
v, r = [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]
|
||||||
for i, axis in enumerate(['x', 'y', 'z']):
|
for i, axis in enumerate(['x', 'y', 'z']):
|
||||||
m2 = re.search(r'v' + axis + r'\s*=\s*([-\d.]+)', line)
|
m2 = re.search(r'v' + axis + r'\s*=\s*([-\d.]+)', line)
|
||||||
|
|||||||
@@ -5,5 +5,5 @@
|
|||||||
# rx → elevation(俯仰), ry → azimuth(方位), rz → (预留)
|
# rx → elevation(俯仰), ry → azimuth(方位), rz → (预留)
|
||||||
#
|
#
|
||||||
# 示例:前60帧向右平移+绕x旋转,30-90帧向上平移+绕y绕z旋转
|
# 示例:前60帧向右平移+绕x旋转,30-90帧向上平移+绕y绕z旋转
|
||||||
1-60 vx=0.02 rx=1
|
all vx=0.02
|
||||||
30-90 vy=0.02 ry=1 rz=1
|
# 30-90 vy=0.02 ry=1 rz=1
|
||||||
|
|||||||
Reference in New Issue
Block a user