Cropping depth streams

Hi,

I’m having an issue when trying to crop depth images on my orbbec persee on ubuntu 14.04 using openni in python. The set_cropping seems to be accepted with no errors, but when I actually try to get the depth image, it freezes with no error message. My terminal won’t even accept ctrl-c to stop the program, and I have to close the terminal. My code is below:

import cv2
from primesense import openni2
from primesense import _openni2 as c_api

openni2.initialize("/home/orbbec/OpenNI-Linux-Arm-2.2/OpenNI-Linux-Arm-2.2/Redist")

dev = openni2.Device.open_any()


### set up depth stream
depth_stream = dev.create_depth_stream()
depth_stream.set_video_mode(c_api.OniVideoMode(pixelFormat = c_api.OniPixelFormat.ONI_PIXEL_FORMAT_DEPTH_1_MM, resolutionX = 640, resolutionY = 480, fps = 30))
status = depth_stream.set_cropping( 0, 100, 640, 250)

depth_stream.start()

###get depths
for i in range (0,10):


	print ("getting frame")
	frame = depth_stream.read_frame()
	depth_data = frame.get_buffer_as_uint16()

	print ("depth frame captured")
depth_stream.stop()

A year ago I tried exactly same thing with exactly same result. Seems that OpenNI2 build for Astra cameras does not implement crop functionality correctly. My solution was to crop depth map after receiving.