Hello all. I got opencv to work with python but it seems that when I try to run this c++ example it is having a hard time finding the associated files. Idk how to link libraries or add a path so hopefully someone knows what I am missing. Thanks
im not sure how to post code either so apologies if it is wrong.
also I changed the paths to match where my files are, you can see that in the terminal
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
cvNamedWindow("Capture Example", CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCreateCameraCapture(0);
IplImage* frame;
while(1)
{
frame=cvQueryFrame(capture);
if(!frame) break;
cvShowImage("Capture Example", frame);
char c = cvWaitKey(33);
if( c == 27 ) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Capture Example");
};
MAKEFILE:
INCLUDE_DIRS =
LIB_DIRS =
CC=g++
CDEFS=
CFLAGS= -O0 -g $(INCLUDE_DIRS) $(CDEFS)
LIBS= -lrt
CPPLIBS= -L/usr/lib -lopencv_core -lopencv_flann -lopencv_video
HFILES=
CFILES=
CPPFILES= capture.cpp
SRCS= ${HFILES} ${CFILES}
CPPOBJS= ${CPPFILES:.cpp=.o}
all: capture
clean:
-rm -f *.o *.d
-rm -f capture
distclean:
-rm -f *.o *.d
capture: capture.o
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $@.o `pkg-config --libs opencv` $(CPPLIBS)
depend:
.c.o:
$(CC) $(CFLAGS) -c $<
.cpp.o:
$(CC) $(CFLAGS) -c $<