2 import pyrealsense2
as rs
12 print(
'Number of arguments:', len(sys.argv),
'arguments.')
13 print(
'Argument List:',
str(sys.argv))
14 mc_ip_address =
'224.0.0.1' 20 frames = pipeline.wait_for_frames()
23 depth = frames.get_depth_frame()
25 depth2 = depth_filter.process(depth)
29 depthData = depth2.as_frame().get_data()
30 depthMat = np.asanyarray(depthData)
31 ts = frames.get_timestamp()
37 cfg.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
38 pipeline = rs.pipeline()
39 pipeline_profile = pipeline.start(cfg)
40 sensor = pipeline_profile.get_device().first_depth_sensor()
46 print(self.recv(1024))
54 asyncore.dispatcher.__init__(self)
55 print(
"Launching Realsense Camera Server")
59 print(
"Unexpected error: ", sys.exc_info()[1])
61 self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
62 print(
'sending acknowledgement to', address)
66 self.decimate_filter.set_option(rs.option.filter_magnitude, 2)
68 self.connect((address[0], 1024))
72 print(
"connection received")
81 data = pickle.dumps(depth)
83 length = struct.pack(
'<I', len(data))
85 ts = struct.pack(
'<d', timestamp)
91 if not hasattr(self,
'frame_data'):
107 def __init__(self, host = mc_ip_address, port=1024):
108 asyncore.dispatcher.__init__(self)
109 server_address = (
'', port)
110 self.create_socket(socket.AF_INET, socket.SOCK_DGRAM)
111 self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
112 self.bind(server_address)
115 data, addr = self.socket.recvfrom(42)
116 print(
'Recived Multicast message %s bytes from %s' % (data, addr))
119 print(sys.stderr, data)
128 channel, addr = self.accept()
129 print(
'received %s bytes from %s' % (data, addr))
138 if __name__ ==
'__main__':
std::string join(const std::string &base, const std::string &path)
static std::string print(const transformation &tf)
def __init__(self, address)
def __init__(self, host=mc_ip_address, port=1024)
def getDepthAndTimestamp(pipeline, depth_filter)