Beaglebone openCV, problem compiling

400 views
Skip to first unread message

lostcaggy

unread,
Apr 17, 2012, 5:25:23 PM4/17/12
to beagl...@googlegroups.com
I'm using Netbeans on Mac os x, compiling remotely on the beaglebone. Angstrom image from the 9th April 2012.

the code is


#include <stdio.h>
#include <opencv/cvaux.h>
#include <opencv/highgui.h>
#include <opencv/cxcore.h>

int main(int argc, char* argv[])
{
  CvCapture* camera = cvCreateCameraCapture(-1); // Use the default camera

  IplImage*     frame = 0;
  IplImage      img;

  frame = cvQueryFrame(camera); //need to capture at least one extra frame
  frame = cvQueryFrame(camera);
  if (frame != NULL) {
    printf("got frame\n\r");
        cvSaveImage("webcam.jpg", frame);
  } else {
      printf("Null frame\n\r");
  }
  cvReleaseCapture(&camera);
  return 0;
}

but I keep getting the following error message. I'm new to this type of programming so could really do with some pointers.

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/testanapp'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/testanapp
make[2]: Entering directory `/testanapp'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/main.o.d
g++    -c -g -I../usr/include -I../usr/lib -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++     -o dist/Debug/GNU-Linux-x86/testanapp build/Debug/GNU-Linux-x86/main.o -L../usr/include -L../usr/lib
build/Debug/GNU-Linux-x86/main.o: In function `main':
/testanapp/main.cpp:14: undefined reference to `cvCreateCameraCapture'
/testanapp/main.cpp:19: undefined reference to `cvQueryFrame'
/testanapp/main.cpp:20: undefined reference to `cvQueryFrame'
/testanapp/main.cpp:23: undefined reference to `cvSaveImage'
/testanapp/main.cpp:27: undefined reference to `cvReleaseCapture'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/testanapp] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/testanapp'
make[1]: Leaving directory `/testanapp'

BUILD FAILED (exit value 2, total time: 14s)

Peter K

unread,
Apr 18, 2012, 10:45:15 AM4/18/12
to beagl...@googlegroups.com
It looks like it might need open to include cv.h. 

Maybe try changing the headers so it's like this, sorry I don't have a beagle here to test:

#include <stdio.h>
#include <cv.h>

or maybe

#include <stdio.h>
#include <opencv/cv.h>

Cheers,
Peter
Reply all
Reply to author
Forward
0 new messages