Skip to content

Commit b108da9

Browse files
author
Yu Sun
committed
update changes
1 parent ff5ea02 commit b108da9

File tree

5 files changed

+44
-193
lines changed

5 files changed

+44
-193
lines changed

romp/lib/utils/util.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def calc_obb(ptSets):
402402
#__________________transform tools_______________________
403403

404404

405-
def transform_rot_representation(rot, input_type='mat',out_type='vec'):
405+
def transform_rot_representation(rot, input_type='mat',out_type='quat',input_is_degrees=True):
406406
'''
407407
make transformation between different representation of 3D rotation
408408
input_type / out_type (np.array):
@@ -418,9 +418,7 @@ def transform_rot_representation(rot, input_type='mat',out_type='vec'):
418418
elif input_type =='vec':
419419
r = R.from_rotvec(rot)
420420
elif input_type =='euler':
421-
if rot.max()<4:
422-
rot = rot*180/np.pi
423-
r = R.from_euler('xyz',rot, degrees=True)
421+
r = R.from_euler('xyz',rot, degrees=input_is_degrees)
424422

425423
if out_type=='mat':
426424
out = r.as_matrix()

simple_romp/bev/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def bev_settings(input_args=sys.argv[1:]):
5353
# not support temporal processing now
5454
parser.add_argument('-t', '--temporal_optimize', action='store_true', help = 'Whether to use OneEuro filter to smooth the results')
5555
parser.add_argument('-sc','--smooth_coeff', type=float, default=3., help = 'The smoothness coeff of OneEuro filter, the smaller, the smoother.')
56+
parser.add_argument('--webcam_id',type=int, default=0, help = 'The Webcam ID.')
5657
args = parser.parse_args(input_args)
5758

5859
if args.model_id != 2:
@@ -304,7 +305,7 @@ def main():
304305
saver.save_video(video_save_path, frame_rate=args.frame_rate)
305306

306307
if args.mode == 'webcam':
307-
cap = WebcamVideoStream(0)
308+
cap = WebcamVideoStream(args.webcam_id)
308309
cap.start()
309310
while True:
310311
frame = cap.read()

simple_romp/romp/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def romp_settings(input_args=sys.argv[1:]):
3737
parser.add_argument('--model_path', type=str, default=osp.join(osp.expanduser("~"),'.romp','ROMP.pkl'), help = 'The path of ROMP checkpoint')
3838
parser.add_argument('--model_onnx_path', type=str, default=osp.join(osp.expanduser("~"),'.romp','ROMP.onnx'), help = 'The path of ROMP onnx checkpoint')
3939
parser.add_argument('--root_align',type=bool, default=False, help = 'Please set this config as True to use the ROMP checkpoints trained by yourself.')
40+
parser.add_argument('--webcam_id',type=int, default=0, help = 'The Webcam ID.')
4041
args = parser.parse_args(input_args)
4142

4243
if not torch.cuda.is_available():
@@ -194,7 +195,7 @@ def main():
194195
saver.save_video(video_save_path, frame_rate=args.frame_rate)
195196

196197
if args.mode == 'webcam':
197-
cap = WebcamVideoStream(0)
198+
cap = WebcamVideoStream(args.webcam_id)
198199
cap.start()
199200
while True:
200201
frame = cap.read()

simple_romp/romp/utils.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ def rotation_matrix_to_quaternion(rotation_matrix, eps=1e-6):
683683

684684

685685

686-
def transform_rot_representation(rot, input_type='mat',out_type='vec'):
686+
def transform_rot_representation(rot, input_type='mat',out_type='quat',input_is_degrees=True):
687687
'''
688688
make transformation between different representation of 3D rotation
689689
input_type / out_type (np.array):
@@ -692,17 +692,14 @@ def transform_rot_representation(rot, input_type='mat',out_type='vec'):
692692
'vec': rotation vector (3)
693693
'euler': Euler degrees in x,y,z (3)
694694
'''
695-
from scipy.spatial.transform import Rotation as R
696695
if input_type=='mat':
697696
r = R.from_matrix(rot)
698697
elif input_type=='quat':
699698
r = R.from_quat(rot)
700699
elif input_type =='vec':
701700
r = R.from_rotvec(rot)
702701
elif input_type =='euler':
703-
if rot.max()<4:
704-
rot = rot*180/np.pi
705-
r = R.from_euler('xyz',rot, degrees=True)
702+
r = R.from_euler('xyz',rot, degrees=input_is_degrees)
706703

707704
if out_type=='mat':
708705
out = r.as_matrix()

0 commit comments

Comments
 (0)