c++ - How to use OpenCV VideoCapture class on Raspberry Pi? -
i have been trying access videocapture class perform image processing on each frame , keep obtaining series of errors, described in order:
:-1: error: main.o: undefined reference symbol '_zn2cv12gaussianblurerkns_11_inputarrayerkns_12_outputarrayens_5size_iieeddi' /usr/local/lib/libopencv_imgproc.so.2.4:-1: error: error adding symbols: dso missing command line :-1: error: collect2: error: ld returned 1 exit status
i using qtcreator , rasberry pi 3. able load image disk why piece of code have literally pulled opencv docs not compile?
i have ensured appropriate video linux drivers loaded entering terminal command:
sudo modprobe bcm2835-v4l2
here link docmentation http://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html
#include "opencv2/opencv.hpp" using namespace cv; int main(int, char**) { videocapture cap(0); // open default camera if(!cap.isopened()) // check if succeeded return -1; mat edges; namedwindow("edges",1); for(;;) { mat frame; cap >> frame; // new frame 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; } // camera deinitialized automatically in videocapture destructor return 0; }
i have resolved question myself, experiences similar issue, error dso (dynamic shared object) indicated library (libopencv_imgproc.so.2.4) missing.
the solution amend .pro file, made following amendments:
includepath += /usr/local/include/opencv --> /usr/local/include/opencv2
libs += -l/usr/local/lib -lopencv_core -lopencv_highgui --> -l/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui
note: if add imgproc library without including opencv2 retain same errors.
Comments
Post a Comment