gpt4 book ai didi

android - OpenCV 2.3 : how to capture frames from Android camera?

转载 作者:太空狗 更新时间:2023-10-29 16:23:50 24 4
gpt4 key购买 nike

我正在尝试在 Android 上使用新的 OpenCV 功能: native 相机访问。根据this文档,这很容易,但我只得到错误而没有成功。

有DDMS日志:

08-26 03:28:56.825: DEBUG/CAMERA_ACTIVITY(12613): Library name: libopencv_java.so 08-26 03:28:56.825: DEBUG/CAMERA_ACTIVITY(12613): Library base address: 0x81800000 08-26 03:28:56.835: DEBUG/CAMERA_ACTIVITY(12613): Libraries folder found: /data/data/com.viactivity.ar/lib/ 08-26 03:28:56.835: DEBUG/CAMERA_ACTIVITY(12613): CameraWrapperConnector::connectToLib: folderPath=/data/data/com.viactivity.ar/lib/ 08-26 03:28:56.835: ERROR/CAMERA_ACTIVITY(12613): ||libnative_camera_r2.2.2.so 08-26 03:28:56.835: ERROR/CAMERA_ACTIVITY(12613): ||libnative_camera_r2.3.3.so 08-26 03:28:56.835: DEBUG/CAMERA_ACTIVITY(12613): try to load library 'libnative_camera_r2.2.2.so' 08-26 03:28:56.835: DEBUG/CAMERA_ACTIVITY(12613): CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library /data/data/com.viactivity.ar/lib/libnative_camera_r2.2.2.so, dlerror="Cannot load library: find_library[1223]: 11258 'libnative_camera_r2.2.2.so' failed to load previously" 08-26 03:28:56.835: DEBUG/CAMERA_ACTIVITY(12613): try to load library 'libnative_camera_r2.3.3.so' 08-26 03:28:56.835: DEBUG/CAMERA_ACTIVITY(12613): CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library /data/data/com.viactivity.ar/lib/libnative_camera_r2.3.3.so, dlerror="Cannot load library: find_library[1223]: 11258 'libnative_camera_r2.3.3.so' failed to load previously" 08-26 03:28:56.835: ERROR/CAMERA_ACTIVITY(12613): CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library 08-26 03:28:56.835: ERROR/CV_CAP(12613): Native_camera returned opening error: 4 08-26 03:28:56.835: ERROR/AR_code(12613): Capture Error!

有两种代码变体:

CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANDROID + 0 ); 
IplImage* frame = cvQueryFrame( capture );
cvReleaseCapture(&capture);

.

cv::VideoCapture capture(CV_CAP_ANDROID + 0);
cv::Mat frame;

capture >> frame;

它们都产生相同的错误。有人能够在 Android 上获得 native 相机访问权限吗?非常感谢!

更新:上面的故事是关于 Android 3.2 的。根据 Andrey Kamaev 的说法,不支持 Android 3.2。我试图在 HTC Wildfire 上测试相同的代码,但出现了另一个错误:

08-26 19:49:06.856: DEBUG/OpenCV_NativeCamera(1337): CameraHandler::initCameraConnect(0x813e65a1, 0, 0x285a20, 0x0) 08-26 19:49:06.856: DEBUG/CameraService(72): CameraService::connect E (pid 1337, client 0x693d8) 08-26 19:49:06.856: DEBUG/CameraService(72): CameraService::connect X (pid 1337, new client 0x693d8) rejected. (old pid 1337, old client 0x18728) 08-26 19:49:06.856: ERROR/OpenCV_NativeCamera(1337): initCameraConnect: Unable to connect to CameraService 08-26 19:49:06.856: ERROR/CAMERA_ACTIVITY(1337): CameraWrapperConnector::connectWrapper ERROR: the initializing function returned false 08-26 19:49:06.856: ERROR/CV_CAP(1337): Native_camera returned opening error: 6

有什么想法吗?

最佳答案

目前 OpenCV 原生相机不支持 Android 3.2(因为它的来源不公开。)

一旦与 Android 3.2 兼容的版本可用,我将发布更新。

更新:

OpenCV trunk 已经有针对 Android 3.x 和 4.0.x 的解决方案。它将包含在 OpenCV 的下一个主要版本中。

关于android - OpenCV 2.3 : how to capture frames from Android camera?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7198912/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com