简体   繁体   中英

cannot get frame from openni device in python-opencv

I am using raspberry pi to get frames from ASUS Xtion openni device.

Python-opencv, OpenNI, and OpenCV are installed on raspberry pi correctly.

I am using the following code:

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)

okay, color_image = capture.retrieve(0, cv.CV_CAP_OPENNI_BGR_IMAGE)

This code was working without any problems before. But now, I always get "okay" value as "false". How can I fix this problem?

Thanks,

Do you have the v4l drivers?

If not

sudo modprobe bcm2835-v4l2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM