19
19
########################################################################
20
20
21
21
import sys
22
- import pyzed .sl as sl
23
22
from signal import signal , SIGINT
24
- import argparse
25
- import os
23
+ import argparse
24
+
25
+
26
+ import pyzed .sl as sl
26
27
27
28
cam = sl .Camera ()
28
29
@@ -35,15 +36,15 @@ def handler(signal_received, frame):
35
36
signal (SIGINT , handler )
36
37
37
38
def main ():
38
-
39
+
39
40
init = sl .InitParameters ()
40
41
init .depth_mode = sl .DEPTH_MODE .NONE # Set configuration parameters for the ZED
41
42
42
- status = cam .open (init )
43
- if status != sl .ERROR_CODE .SUCCESS :
43
+ status = cam .open (init )
44
+ if status != sl .ERROR_CODE .SUCCESS :
44
45
print ("Camera Open" , status , "Exit program." )
45
46
exit (1 )
46
-
47
+
47
48
recording_param = sl .RecordingParameters (opt .output_svo_file , sl .SVO_COMPRESSION_MODE .H264 ) # Enable recording with the filename specified in argument
48
49
err = cam .enable_recording (recording_param )
49
50
if err != sl .ERROR_CODE .SUCCESS :
@@ -58,12 +59,12 @@ def main():
58
59
if cam .grab (runtime ) == sl .ERROR_CODE .SUCCESS : # Check that a new image is successfully acquired
59
60
frames_recorded += 1
60
61
print ("Frame count: " + str (frames_recorded ), end = "\r " )
61
-
62
+
62
63
if __name__ == "__main__" :
63
64
parser = argparse .ArgumentParser ()
64
65
parser .add_argument ('--output_svo_file' , type = str , help = 'Path to the SVO file that will be written' , required = True )
65
66
opt = parser .parse_args ()
66
- if not opt .output_svo_file .endswith (".svo" ) and not opt .output_svo_file .endswith (".svo2" ):
67
+ if not opt .output_svo_file .endswith (".svo" ) and not opt .output_svo_file .endswith (".svo2" ):
67
68
print ("--output_svo_file parameter should be a .svo file but is not : " ,opt .output_svo_file ,"Exit program." )
68
69
exit ()
69
70
main ()
0 commit comments