Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions opencv/opencv_composite_stereo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@

# GStreamer string, may be possible to optimize this further?
gst_string = '''
nvarguscamerasrc sensor-id=0 wbmode=0 aelock=true ispdigitalgainrange=\"1 8\" gainrange=\"1 48\" name=left
nvarguscamerasrc sensor-id=1 wbmode=0 aelock=true ispdigitalgainrange=\"1 8\" gainrange=\"1 48\" name=right
nvarguscamerasrc sensor-id=0 wbmode=1 ispdigitalgainrange=\"1 8\" gainrange=\"1 48\" tnr-mode=0 exposuretimerange="2000 20000000" saturation=1.3 name=left
nvarguscamerasrc sensor-id=1 wbmode=1 ispdigitalgainrange=\"1 8\" gainrange=\"1 48\" tnr-mode=0 exposuretimerange="2000 20000000" saturation=1.3 name=right
glstereomix name=mix
left. ! video/x-raw(memory:NVMM),width={image_size[1]},height={image_size[0]},framerate={framerate}/1 ! nvvidconv ! video/x-raw ! glupload ! mix.
left. ! video/x-raw(memory:NVMM),width={image_size[1]},height={image_size[0]},framerate={framerate}/1 ! nvvidconv ! video/x-raw ! glupload ! mix.
right. ! video/x-raw(memory:NVMM),width={image_size[1]},height={image_size[0]},framerate={framerate}/1 ! nvvidconv ! video/x-raw ! glupload ! mix.
mix. ! video/x-raw(memory:GLMemory),multiview-mode=side-by-side ! glcolorconvert ! gldownload !
queue ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink'
mix. ! video/x-raw(memory:GLMemory),multiview-mode=side-by-side ! glcolorconvert ! gldownload !
queue ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink'
'''

# ! glcolorbalance constrast=0.1 brightness=0.2 saturation=1.2

gst_string = gst_string.format(image_size=image_size, framerate=framerate)
print(gst_string)

Expand Down
4 changes: 2 additions & 2 deletions opencv/opencv_sobel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Sample script which uses OpenCV to read images from one camera,
# then runs some basic image processing ... Gaussian blue and Sobel edges.
Expand All @@ -17,7 +17,7 @@
framerate = 10

# GStreamer string, may be possible to optimize this further?
gst_string = f"nvarguscamerasrc sensor-id={camera_num} ! video/x-raw(memory:NVMM),width={image_size[1]},height={image_size[0]},framerate={framerate}/1 ! nvvidconv ! queue ! video/x-raw,pixel-format=(string)BGR ! videoconvert ! video/x-raw,pixel-format=(string)BGR ! appsink"
gst_string = f'nvarguscamerasrc sensor-id={camera_num} wbmode=0 aelock=true ispdigitalgainrange="1 8" gainrange="1 48" exposuretimerange="35000 100000000" ! video/x-raw(memory:NVMM),width={image_size[1]},height={image_size[0]},framerate={framerate}/1 ! nvvidconv ! queue ! video/x-raw,pixel-format=(string)BGR ! gamma gamma=0.7 ! videobalance brightness=0.2 ! videoconvert ! video/x-raw,pixel-format=(string)BGR ! appsink'

print(f"Using GStreamer configuration: {gst_string}")

Expand Down