2014-01-08 3 views
0

Я пытаюсь скомпилировать код видеозахвата с помощью OpenCV на плате Gumstix Arm. Следующий код работает безупречно на моем ноутбуке, и я могу записывать видео, но когда я компилирую его на доске, он дает неизвестные ошибки.OpenCV- C++ на armv71 дает неизвестные ошибки

Мой код:

#include "/usr/include/opencv2/opencv.hpp" 
#include "/usr/include/opencv2/core/core_c.h" 
#include "/usr/include/opencv2/core/core.hpp" 
#include "/usr/include/opencv2/flann/miniflann.hpp" 
#include "/usr/include/opencv2/imgproc/imgproc_c.h" 
#include "/usr/include/opencv2/imgproc/imgproc.hpp" 
#include "/usr/include/opencv2/video/video.hpp" 
#include "/usr/include/opencv2/features2d/features2d.hpp" 
#include "/usr/include/opencv2/objdetect/objdetect.hpp" 
#include "/usr/include/opencv2/calib3d/calib3d.hpp" 
#include "/usr/include/opencv2/ml/ml.hpp" 
#include "/usr/include/opencv2/highgui/highgui_c.h" 
#include "/usr/include/opencv2/highgui/highgui.hpp" 
#include "/usr/include/opencv2/contrib/contrib.hpp" 
#include <iostream> 
#include <sys/time.h> 
#include <signal.h> 
#include <unistd.h> 

using namespace std; 
using namespace cv; 

#define FPS 10 

bool running; 

float time_elapsed(timespec start, timespec end) 
{ 
    return (end.tv_sec + end.tv_nsec/1000000000.0) - (start.tv_sec + start.tv_nsec/1000000000.0); 
} 
void end_signal(int a) 
{ 
    cout << "Closing feed due to user input" << endl; 
    running = false; 
} 

int main(int argc, char* argv[]) 
{ 


     cout<<"Videocapture "<<argv[0]<<" has "<<argc - 1<<" arguments\n"; 
      int devNum = atoi(argv[1]); 

VideoCapture camera(devNum); 

    camera.set(CV_CAP_PROP_FRAME_WIDTH,640); 
    camera.set(CV_CAP_PROP_FRAME_HEIGHT,480); 

    int height = camera.get(CV_CAP_PROP_FRAME_HEIGHT); 
    int width = camera.get(CV_CAP_PROP_FRAME_WIDTH); 

    VideoWriter capture("./output.avi",CV_FOURCC('I','4','2','0'),FPS,Size(width,height),true); 

    running = true; 
    signal(SIGINT,end_signal); 

    Mat raw_frame; 

    cout << "begin recording..." << endl; 

    timespec current_frame, last_frame; 

    clock_gettime(CLOCK_MONOTONIC,&last_frame); 

    float spf = 1/FPS; 


    while(running) 
    { 
     clock_gettime(CLOCK_MONOTONIC,&current_frame); 
     if(spf < time_elapsed(last_frame,current_frame)) 
     { 
      camera >> raw_frame; 
      capture << raw_frame; 
      clock_gettime(CLOCK_MONOTONIC,&last_frame); 
      cout << "FRAME!" << endl; 
     } 
    } 
    camera.release(); 
    capture.release(); 
    cout << "All done!" << endl; 
    return 0; 
} 

Я написал Makefile для этого:

#!/bin/sh 
export LD_LIBRARY_PATH=/root/usr/lib 
echo `pkg-config --cflags opencv` 
echo `pkg-config --libs opencv` 
g++ `pkg-config --cflags opencv` -g -g -o $3 $2 $1 `pkg-config --libs opencv` 

$ chmod +x makefile.sh 
$ ./makefile 
$ ./makefile.sh videorecording.cpp videorecording 

$ export LD_LIBRARY_PATH=/root/usr/lib 

Ошибки:

videorecording.cpp:42:60: warning: missing terminating " character [enabled by default] 
videorecording.cpp:42:9: error: missing terminating " character 
videorecording.cpp:43:1: error: stray '\' in program 
videorecording.cpp:43:12: warning: missing terminating " character [enabled by default] 
videorecording.cpp:43:1: error: missing terminating " character 
videorecording.cpp: In function 'int main(int, char**)': 
videorecording.cpp:43:1: error: 'arguments' was not declared in this scope 
videorecording.cpp:43:11: error: expected ';' before 'n' 
videorecording.cpp:46:22: error: 'devNum' was not declared in this scope 

Это отлично работает на ноутбуке, но не на устройстве руки

ответ

0

У вас есть openCV com сбито из исходного источника или установлено Использование opkg? Мне не нужно добавлять/usr/include/... Я использовал openCV раньше на Gumstix, и я попытаюсь реплицировать ваш пример и обратную связь.

Смежные вопросы