运行时opencv的HighGui错误 - " HIGHGUI错误:V4L / V4L2:VIDIOC_S_CROP&QUOT ;. OpenCV的交叉编译。主机= 64位的Ubuntu 12.04。目标= ARM-的Cortex-A9 [英] Runtime Opencv HighGui Error- "HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP". Opencv cross compiled. Host=64bit Ubuntu 12.04. Target=ARM-Cortex-A9

查看:1703
本文介绍了运行时opencv的HighGui错误 - " HIGHGUI错误:V4L / V4L2:VIDIOC_S_CROP&QUOT ;. OpenCV的交叉编译。主机= 64位的Ubuntu 12.04。目标= ARM-的Cortex-A9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OpenCV的一个初学者,尽我所能得到的嵌入式平台上运行一个简单的应用程序。我交叉编译OpenCV的2.4.4和建造它WITH_GTK = ON,WITH_UNICAP = ON,WITH_V4L需要摄像头和GUI支持= ON。在主机下面的示例code交叉编译:

#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace cv; 
int main(int, char**)
{
    VideoCapture cap(0); // open the default camera
    if (!cap.isOpened()) // check if we succeeded
        return -1;

    Mat edges;
    namedWindow("edges", 1);
    for (;;) {
        Mat frame;
        cap >> frame;   // get a new frame from camera
        cvtColor(frame, edges, CV_BGR2GRAY);
        GaussianBlur(edges, edges, Size(7, 7), 1.5, 1.5);
        Canny(edges, edges, 0, 30, 3);
        imshow("edges", edges);
        if (waitKey(30) >= 0)
            break;
    }
    return 0;
}

编译这种方式对于静态链接:

Compiling this way for static linking:

ARM-Linux的gnueabi-G ++ -mcpu =的cortex-A9 -mfpu =霓虹灯-static opencv_camshow.cpp -o EXE -I /家庭/ OM / OpenCV的-2.4.4 /平台/ Linux的/ build_soft /安装/包括-L /家庭/ OM / OpenCV的-2.4.4 /平台/ Linux的/ build_soft /安装/ lib目录-L /家庭/ OM / OpenCV的-2.4.4 /平台/ Linux的/ build_soft /的3rdParty / lib目录-lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_imgproc -lopencv_core -lopencv_contrib -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_flann -lopencv_photo -lopencv_videostab -pthread -lm -lrt -lzlib -static

arm-linux-gnueabi-g++ -mcpu=cortex-a9 -mfpu=neon -static opencv_camshow.cpp -o exe -I/home/om/OpenCV-2.4.4/platforms/linux/build_soft/install/include -L/home/om/OpenCV-2.4.4/platforms/linux/build_soft/install/lib -L/home/om/OpenCV-2.4.4/platforms/linux/build_soft/3rdparty/lib -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_imgproc -lopencv_core -lopencv_contrib -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_flann -lopencv_photo -lopencv_videostab -pthread -lm -lrt -lzlib -static

这是问题所在。当我尝试在目标上运行的可执行文件EXE,我得到这个运行时错误:

Here is the problem. When I try to run the executable file 'exe' on the target, I get this runtime error:

HIGHGUI错误:V4L / V4L2:VIDIOC_S_CROP
OpenCV的错误:。未指定的错误(该功能未实现重建与Windows,GTK + 2.x或碳支持库如果您在Ubuntu或Debian的安装libgtk2.0-dev的和pkg配置,然后重新运行cmake或cvNamedWindow配置脚本),文件/home/om/OpenCV-2.4.4/modules/highgui/src/window.cpp,线路652

HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /home/om/OpenCV-2.4.4/modules/highgui/src/window.cpp, line 652

抛出CV ::异常

什么():/home/om/OpenCV-2.4.4/modules/highgui/src/window.cpp:652:错误:(-2)的功能尚未实现。重建与Windows,GTK + 2.x或碳支持库。如果您在Ubuntu或Debian的安装libgtk2.0-dev的和pkg配置,然后重新运行cmake或功能cvNamedWindow配置脚本

what(): /home/om/OpenCV-2.4.4/modules/highgui/src/window.cpp:652: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvNamedWindow

我重新安装了libgtk2.0-dev的,pkg配置存在和放大器;重新编译OpenCV的,但是这并没有帮助。请让我知道,如果有人知道如何解决这个问题。提前致谢。 〜嗡

I re-installed libgtk2.0-dev, pkg-config exists & re-compiled OpenCV , but this hasn't helped. Please let me know if someone knows how to overcome this issue. Thanks in advance. ~Om

更多信息:
我想通了,是什么原因造成这个问题,但没有固定它...

More info: I figured out what is causing this problem but not yet fixed it...

从我的理解问题出在OpenCV中的CMake的脚本。它不承认GTK的存在,并没有GTK支持,因此交叉编译。这之后确保基于ARM的GTK库在工具链的lib文件夹及其路径出口到系统路径present。

From my understanding the problem lies in the cmake scripts of opencv. It does not acknowledge existence of GTK and hence cross compiles with no gtk support. This after making sure that the arm-based gtk library is present in the toolchain's lib folder and its path exported to system paths.

推荐答案

cmake的语句后确认是否 cmake的包含以下内容: V4L / V4L2:使用libv4l改进

After doing the cmake statement Verify whether the output of cmake includes the following text: V4L/V4L2: Using libv4l.

如果它不存在,然后安装 v4l2ucp 为v41-utils的 libv4l改进-dev 来自新立得软件包管理器。然后 cmake的并重新建立。

If it is not there, then install v4l2ucp, v4l-utils and libv4l-dev from synaptic package manager. Then cmake and build again.

这为我工作,但我用在Ubuntu 12.04的Python绑定的OpenCV。

This worked for me but I was using OpenCV with python bindings on Ubuntu 12.04.

这篇关于运行时opencv的HighGui错误 - &QUOT; HIGHGUI错误:V4L / V4L2:VIDIOC_S_CROP&QUOT ;. OpenCV的交叉编译。主机= 64位的Ubuntu 12.04。目标= ARM-的Cortex-A9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆