New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCV Python unable to access correct OpenNI device channels #4735

Open
opencv-pushbot opened this Issue Jul 27, 2015 · 0 comments

Comments

1 participant
@opencv-pushbot
Copy link
Contributor

opencv-pushbot commented Jul 27, 2015

Transferred from http://code.opencv.org/issues/3663

|| Andrew Braun on 2014-04-24 03:48
|| Priority: Normal
|| Affected: 2.4.9 (latest release)
|| Category: highgui-camera
|| Tracker: Bug
|| Difficulty: Medium
|| PR: 
|| Platform: x64 / Linux

OpenCV Python unable to access correct OpenNI device channels

I put together some simple code in python to grab different channels from OpenNI devices. I built OpenCV myself with all the PrimeSense and OpenNI support enabled. The OpenNI samples work perfectly for both the Kinect sensor and PrimeSense sensor, as well as the OpenCV samples  for testing OpenNI support (./cpp-example-openni_capture). 

Here is the code I put together.

@   

    import cv2
    import cv2.cv as cv
    capture = cv2.VideoCapture(cv.CV_CAP_OPENNI)
    capture.set(cv.CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE, cv.CV_CAP_OPENNI_VGA_30HZ)
    print capture.get(cv.CV_CAP_PROP_OPENNI_REGISTRATION)
    while True:
        if not capture.grab():
            print "Unable to Grab Frames from camera"
            break
        okay1, depth_map = capture.retrieve(cv.CV_CAP_OPENNI_DEPTH_MAP)
        if not okay1:
            print "Unable to Retrieve Disparity Map from camera"
            break
        okay2, gray_image = capture.retrieve(cv.CV_CAP_OPENNI_GRAY_IMAGE)
        if not okay2:
            print "Unable to retrieve Gray Image from device"
            break
        cv2.imshow("depth camera", depth_map)
        cv2.imshow("rgb camera", gray_image)
        if cv2.waitKey(10) == 27:
            break
    cv2.destroyAllWindows()
    capture.release()
@

So everything runs fine, but the results that are being displayed are not the correct channels... For example if I wanted to access the gray image channel and the depth map channel, both images being displayed are depth_maps. 

Yes I've tried accessing other channels and changing the OPENNI_IMAGE_GENERATOR_MODE. Unfortunately the results have stayed consistent. No matter what I try I always get the same depth channel back. depth_map-gray_image yields an all black image.

Like I said the C++ OpenCV OpenNI examples all work perfectly for both the Kinect sensor and primesense sensor. It seems like a problem with the Python modules, or I am doing something really stupid.

Running on Ubuntu 12.04 LTS OpenCV version 2.4.9

Thanks for helping.
Drew

History

Alexander Smorkalov on 2014-04-30 19:05
-   Target version changed from 2.4.9 to 2.4.10
Dmitry Retinskiy on 2014-09-17 10:12
Alexander, could you check this?
Thanks.
-   Affected version changed from 2.4.8 (latest release) to 2.4.9
    (latest release)
-   Assignee set to Alexander Smorkalov
-   Status changed from New to Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment