Skip to content

Commit 50cdaba

Browse files
authored
Update for ZED SDK 2.8 (#76)
1 parent 4103b75 commit 50cdaba

File tree

8 files changed

+548
-23
lines changed

8 files changed

+548
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The changes were made to better reflect the C++ API and ease of use. Mainly all
1515

1616
### Prerequisites
1717

18-
- [ZED SDK 2.7](https://www.stereolabs.com/developers/) and its dependency
18+
- [ZED SDK 2.8](https://www.stereolabs.com/developers/) and its dependency
1919
[CUDA](https://developer.nvidia.com/cuda-downloads)
2020
- Python 3.5+ (x64). ([Windows installer](https://www.python.org/ftp/python/3.6.2/python-3.6.2-amd64.exe))
2121
- C++ compiler (VS2015 recommended)

examples/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,16 @@ Plane sample is searching for the floor in a video and extracts it into a mesh i
4141
```
4242
python examples/plane_example.py svo_file.svo
4343
```
44+
45+
### Streaming
46+
47+
These 2 samples show the local network streaming capabilities of the SDK. The sender is opening the camera and transmitting the images.
48+
The receiver opens the network image stream and display the images.
49+
50+
```
51+
python examples/camera_streaming/sender/streaming_sender.py
52+
```
53+
54+
```
55+
python examples/camera_streaming/receiver/streaming_receiver.py 127.0.0.1
56+
```
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
########################################################################
2+
#
3+
# Copyright (c) 2017, STEREOLABS.
4+
#
5+
# All rights reserved.
6+
#
7+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
12+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
13+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
15+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
16+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
17+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18+
#
19+
########################################################################
20+
21+
"""
22+
Read SVO sample to read the video and the information of the camera. It can pick a frame of the svo and save it as
23+
a JPEG or PNG file. Depth map and Point Cloud can also be saved into files.
24+
"""
25+
import sys
26+
import pyzed.sl as sl
27+
import cv2
28+
29+
30+
def main():
31+
32+
init = sl.InitParameters()
33+
init.camera_resolution = sl.RESOLUTION.RESOLUTION_HD720
34+
init.depth_mode = sl.DEPTH_MODE.DEPTH_MODE_PERFORMANCE
35+
36+
if (len(sys.argv) > 1) :
37+
ip = sys.argv[1]
38+
init.set_from_stream(ip)
39+
else :
40+
print('Usage : python3 streaming_receiver.py ip')
41+
exit(1)
42+
43+
cam = sl.Camera()
44+
status = cam.open(init)
45+
if status != sl.ERROR_CODE.SUCCESS:
46+
print(repr(status))
47+
exit(1)
48+
49+
runtime = sl.RuntimeParameters()
50+
mat = sl.Mat()
51+
52+
key = ''
53+
print(" Quit : CTRL+C\n")
54+
while key != 113:
55+
err = cam.grab(runtime)
56+
if (err == sl.ERROR_CODE.SUCCESS) :
57+
cam.retrieve_image(mat, sl.VIEW.VIEW_LEFT)
58+
cv2.imshow("ZED", mat.get_data())
59+
key = cv2.waitKey(1)
60+
else :
61+
key = cv2.waitKey(1)
62+
63+
cam.close()
64+
65+
if __name__ == "__main__":
66+
main()
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
########################################################################
2+
#
3+
# Copyright (c) 2017, STEREOLABS.
4+
#
5+
# All rights reserved.
6+
#
7+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
12+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
13+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
15+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
16+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
17+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18+
#
19+
########################################################################
20+
21+
"""
22+
Read SVO sample to read the video and the information of the camera. It can pick a frame of the svo and save it as
23+
a JPEG or PNG file. Depth map and Point Cloud can also be saved into files.
24+
"""
25+
import sys
26+
import pyzed.sl as sl
27+
import cv2
28+
29+
30+
def main():
31+
32+
init = sl.InitParameters()
33+
init.camera_resolution = sl.RESOLUTION.RESOLUTION_HD720
34+
init.depth_mode = sl.DEPTH_MODE.DEPTH_MODE_NONE
35+
cam = sl.Camera()
36+
status = cam.open(init)
37+
if status != sl.ERROR_CODE.SUCCESS:
38+
print(repr(status))
39+
exit(1)
40+
41+
runtime = sl.RuntimeParameters()
42+
43+
stream = sl.StreamingParameters()
44+
stream.codec = sl.STREAMING_CODEC.STREAMING_CODEC_AVCHD
45+
stream.bitrate = 4000
46+
status = cam.enable_streaming(stream)
47+
if status != sl.ERROR_CODE.SUCCESS:
48+
print(repr(status))
49+
exit(1)
50+
51+
print(" Quit : CTRL+C\n")
52+
while True:
53+
err = cam.grab(runtime)
54+
55+
cam.disable_streaming()
56+
cam.close()
57+
58+
if __name__ == "__main__":
59+
main()

0 commit comments

Comments
 (0)