Я использую Ubuntu 16.04 и версию студента MATLAB R2016b, OpenCV 3.1, установленный следующим это учебное руководство.
Я загрузил исходный код для OpenTLD, отслеживающего алгоритм, и пытаюсь выполнить compile.m файл и встретиться со следующими ошибками
Как примечание стороны я реализовал изменения, которые решают вопрос при поиске cv.h заголовочного файла
Определения были
(#include "cv.h")
(#include "highgui.h")
и были изменены на
(#include <opencv/cv.h>)
Ошибка я получаю при выполнении compile.m
Error using mex
/tmp/mex_36621193718999_4249/lk.o: In function `normCrossCorrelation(_IplImage*, _IplImage*, CvPoint2D32f*, CvPoint2D32f*,
int, char*, float*, int, int)':
lk.cpp:(.text+0x1a0): undefined reference to `cvCreateImage'
lk.cpp:(.text+0x1b9): undefined reference to `cvCreateImage'
lk.cpp:(.text+0x1d6): undefined reference to `cvCreateImage'
lk.cpp:(.text+0x214): undefined reference to `cvGetRectSubPix'
lk.cpp:(.text+0x227): undefined reference to `cvGetRectSubPix'
lk.cpp:(.text+0x23b): undefined reference to `cvMatchTemplate'
lk.cpp:(.text+0x274): undefined reference to `cvReleaseImage'
lk.cpp:(.text+0x27d): undefined reference to `cvReleaseImage'
lk.cpp:(.text+0x286): undefined reference to `cvReleaseImage'
/tmp/mex_36621193718999_4249/lk.o: In function `mexFunction':
lk.cpp:(.text+0x323): undefined reference to `cvReleaseImage'
lk.cpp:(.text+0x341): undefined reference to `cvReleaseImage'
lk.cpp:(.text+0x438): undefined reference to `cvCreateImage'
lk.cpp:(.text+0x455): undefined reference to `cvCreateImage'
lk.cpp:(.text+0x4be): undefined reference to `cvCreateImage'
lk.cpp:(.text+0x4dc): undefined reference to `cvCreateImage'
lk.cpp:(.text+0x553): undefined reference to `cvAlloc'
lk.cpp:(.text+0x565): undefined reference to `cvAlloc'
lk.cpp:(.text+0x578): undefined reference to `cvAlloc'
lk.cpp:(.text+0x613): undefined reference to `cvAlloc'
lk.cpp:(.text+0x61e): undefined reference to `cvAlloc'
/tmp/mex_36621193718999_4249/lk.o:lk.cpp:(.text+0x626): more undefined references to `cvAlloc' follow
/tmp/mex_36621193718999_4249/lk.o: In function `mexFunction':
lk.cpp:(.text+0x6c1): undefined reference to `cvCalcOpticalFlowPyrLK'
lk.cpp:(.text+0x73e): undefined reference to `cvCalcOpticalFlowPyrLK'
collect2: error: ld returned 1 exit status
Error in compile (line 77)
eval(['mex lk.cpp -O' include lib]);
Похоже, что обеспеченный compile.m
соединен проводами для конкретной версии (и местоположение) OpenCV:
if isunix
disp('Unix');
include = ' -I/usr/local/include/opencv/ -I/usr/local/include/';
libpath = '/usr/local/lib/';
files = dir([libpath 'libopencv*.so.2.2']);
я смог заставить это компилировать и связываться на 64-разрядной Ubuntu 16.04 со стандартом libopencv-dev
2.4.9 из репозитория путем внесения следующих изменений:
if isunix
disp('Unix');
include = ' -I/usr/include/opencv/ -I/usr/include/';
libpath = '/usr/lib/x86_64-linux-gnu/';
files = dir([libpath 'libopencv*.so.2.4'])
нбар я не попытался протестировать получающееся mexa64
объекты