Beispiel #1
0
import numpy as np  # `pip install numpy`
import cv2  # `pip install opencv-python`
import leapuvc  #  Ensure leapuvc.py is in this folder

# Start the Leap Capture Thread
leap = leapuvc.leapImageThread(resolution=(640, 480))
leap.start()
leap.setExposure(16666)  # Sets the exposure time in microseconds
leap.setGain(63)  # Amplifies the signal in the image


# Define some trackbars to edit stereo matching parameters
def nothing(x):
    pass


cv2.namedWindow('Settings')
cv2.createTrackbar('Use SGBM', 'Settings', 0, 1, nothing)
cv2.createTrackbar('BlockSize', 'Settings', 5, 32, nothing)
cv2.createTrackbar('UQRatio', 'Settings', 70, 255, nothing)
cv2.createTrackbar('TexThresh', 'Settings', 248, 255, nothing)
cv2.createTrackbar('P1', 'Settings', 0, 320 * 3 * 3**2, nothing)
cv2.createTrackbar('P2', 'Settings', 100, 320 * 3 * 3**2, nothing)
cv2.createTrackbar('Exposure', 'Settings', 16666, 65535, leap.setExposure)

# Capture images until 'q' is pressed
while ((not (cv2.waitKey(1) & 0xFF == ord('q'))) and leap.running):
    newFrame, leftRightImage = leap.read()
    if (newFrame):
        rectifiedImages = []
        for i, cam in enumerate(leap.cameras):
Beispiel #2
0
import numpy as np  # `pip install numpy`
import cv2  # `pip install opencv-python`
import leapuvc  #  Ensure leapuvc.py is in this folder

# Start the Leap Capture Thread
#cv2.waitKey(20000)
leap = leapuvc.leapImageThread()
leap.start()

# Capture images until 'q' is pressed
while ((not (cv2.waitKey(1) & 0xFF == ord('q'))) and leap.running):
    newFrame, leftRightImage = leap.read()
    if (newFrame):
        # Display the raw frame
        cv2.imshow('Frame L', leftRightImage[0])
        cv2.imshow('Frame R', leftRightImage[1])

cv2.destroyAllWindows()
Beispiel #3
0
import numpy as np  # `pip install numpy`
import cv2  # `pip install opencv-python`
import leapuvc  #  Ensure leapuvc.py is in this folder

numLeaps = 2

# Start the Leap Capture Threads
leaps = []
for i in range(numLeaps):
    leaps.append(leapuvc.leapImageThread(source=i))
    leaps[i].start()

# Capture images until 'q' is pressed
while ((not (cv2.waitKey(1) & 0xFF == ord('q')))
       and leapuvc.allLeapsRunning(leaps)):
    for i, leap in enumerate(leaps):
        newFrame, leftRightImage = leap.read()
        if (newFrame):
            # Display the raw frame
            cv2.imshow('Leap ' + str(i) + ', Frame L', leftRightImage[0])
            cv2.imshow('Leap ' + str(i) + ', Frame R', leftRightImage[1])

cv2.destroyAllWindows()