Retrieving Channels from Kinect device using python OpenCV -


I put some simple code in Python to capture different channels from OpenNi devices, I have opencv all the primers and open Enabled with NI support was made. OpenNI samples work perfectly for both Kinect sensor and Prison sensor, as well as OpenCV samples for testing OpenNi support (./cpp-example-openni_capture)

Here I have put together the code. CV2 import cv2.cv = cv2.VideoCapture (cv.CV_CAP_OPENNI) capture.set (cv.CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE, cv.CV_CAP_OPENNI_VGA_30HZ) as CV capture Capture capture.get (cv. CV_CAP_PROP_OPENNI_REGISTRATION), while this is true: if not, capture.grab (): Print "Take the frame from the unable camera" okay1 break, depth_map = capture.retrieve (cv.CV_CAP_OPENNI_DEPTH_MAP) if not okay1: print "from the camera again Unable to map inequality map: "okay2 break, gray_image = capture.retrieve (cv.CV_CAP_OPENNI_GRAY_IMAGE) otherwise okay2: print break cv2.imshow (" depth camera ", d epth_map) "unable to get gray image from device" cv2.imshow ("rgb camera", gray_image) if cv2.waitKey (10) == 27: cv2.destroyAllWindows () capture.release () break < / pre>

So everything runs fine, but the results to be displayed are not the right channels ... For example if I want to access the gray image channel and depth map channel, both images are displayed ed deep_maps

Yes, I try to reach other channels and replace OPENNI_IMAGE_GENERATOR_MODE Unfortunately the results are constant. No matter what I try, the channel reaches the same depth I deeper_map-gray_izag creates an all black image.

Like I said that C + OpenCV Open Nii examples serve everyone with a complete connection sensor and premises sensor. It seems like a problem with the Python module, or I'm actually doing something stupid.

EDIT: Ubuntu running on 12.04 LTS

Thanks for helping Drew

get similar () looks:

Python: cv2.VideoCapture Recover ([ image [, channel]]) a ???? Revolve, Image

Then you need two values ​​to pass to retrieve.

I'm not sure which image should be, but sending a holder to a place seems like a trick.


okay1, depth_map = capture.retrieve ( 0 , cv.CV_CAP_OPENNI_DEPTH_MAP)
okay2, gray_image = capture.retrieve ( 0 , Cv.CV_CAP_OPENNI_GRAY_IMAGE)

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -