

The 2D image coordinates of the selected box are printed to the terminal. Run the example code and click + drag on the screen to make a “selection” box.waitKey ( 1 ) & 0xFF # If the 'c' key is pressed, break the while loop if key = ord ( "c" ): break # Close all windows and unload the depth device openni2. imshow ( "Depth Image", img ) key = cv2. First select the correct binary to install (from this page): Ubuntu/Linux 64-bit, GPU enabled, Python 3.5 Requires CUDA toolkit 8.0 and CuDNN v5. rectangle ( img, refPt, refPt, ( 0, 255, 0 ), 2 ) # Display the reshaped depth frame using OpenCV cv2. Install TensorFlow in the virtualenv for python 3: Now, install TensorFlow just as you would for a regular Pip installation. swapaxes ( img, 0, 1 ) if len ( refPt ) > 1 : img = img.

concatenate (( img, img, img ), axis = 0 ) img = np. get_buffer_as_uint16 () # Put the depth frame into a numpy array and reshape it img = np. setMouseCallback ( "Depth Image", point_and_shoot ) # Loop while True : # Grab a new depth frame frame = depth_stream. append (( x, y )) selecting = False print refPt # Initial OpenCV Window Functions cv2. EVENT_LBUTTONUP : print "Mouse Up" refPt. EVENT_LBUTTONDOWN : print "Mouse Down" refPt = selecting = True print refPt elif event = cv2. ONI_PIXEL_FORMAT_DEPTH_100_UM, resolutionX = 640, resolutionY = 480, fps = 30 )) # Function to return some pixel information when the OpenCV window is clicked refPt = selecting = False def point_and_shoot ( event, x, y, flags, param ): global refPt, selecting if event = cv2. open_any () # Start the depth stream depth_stream = dev. #!/usr/bin/python import cv2 import numpy as np from openni import openni2 from openni import _openni2 as c_api # Initialize the depth device openni2.
