Giter Site home page Giter Site logo

Comments (8)

mrnugget avatar mrnugget commented on July 3, 2024

That's weird. It worked for me just a couple of weeks ago on OS X.

Yeah, g++ can't find OpenCV in your output. Did you check what the pkg-config line returns? Do you have opencv installed? In a standard location or somewhere else?

from opencv-haar-classifier-training.

brannondorsey avatar brannondorsey commented on July 3, 2024

Hi there, I've been helping @kaylalewis install and use this awesome package. We cloned and successfully built the version of openCV you mentioned in the README. Once we downloaded openCV to ~/ we moved into the root openCV directory and ran:

cmake # which successfully generated build files
make -j8
make install

Which built and installed openCV binaries. Would this have also built and installed the necessary lib files (like opencv2) and installed them to $PATH?

from opencv-haar-classifier-training.

mrnugget avatar mrnugget commented on July 3, 2024

As far as I know, lib files don't get moved into $PATH, only executables should. And I don't know what the make install step of OpenCV does exactly.

What needs to happen is g++ getting the correct -I and -l flags passed to it. It also needs the correct dylib files (on OS X) to compile. In the instructions I use pkg-config for that. The output of pkg-config looks like this on my machine:

$ pkg-config --libs --cflags opencv | sed 's/libtbb\.dylib/tbb/'
-I/usr/local/Cellar/opencv/2.4.9/include/opencv -I/usr/local/Cellar/opencv/2.4.9/include /usr/local/Cellar/opencv/2.4.9/lib/libopencv_calib3d.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_contrib.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_core.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_features2d.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_flann.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_gpu.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_highgui.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_imgproc.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_legacy.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ml.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_nonfree.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_objdetect.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ocl.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_photo.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_stitching.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_superres.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ts.a /usr/local/Cellar/opencv/2.4.9/lib/libopencv_video.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_videostab.dylib -ltbb

So if you can reproduce this with your manual OpenCV installation it should work.

from opencv-haar-classifier-training.

brannondorsey avatar brannondorsey commented on July 3, 2024

I am now trying to build on my OSX 10.10 machine (following the same steps in the README) and I am also receiving errors on step 6. pkg-config --libs --cflags opencv | sed 's/libtbb\.dylib/tbb/' output is:

-I/usr/local/Cellar/opencv/2.4.9/include/opencv 
-I/usr/local/Cellar/opencv/2.4.9/include 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_calib3d.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_contrib.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_core.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_features2d.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_flann.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_gpu.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_highgui.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_imgproc.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_legacy.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_ml.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_nonfree.dylib
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_objdetect.dylib
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_ocl.dylib
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_photo.dylib
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_stitching.dylib
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_superres.dylib
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_ts.a 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_video.dylib 
/usr/local/Cellar/opencv/2.4.9/lib/libopencv_videostab.dylib 

which, to spare you the comparison, is exactly the output of yours excluding the -ltbb flag which errors with library not found. The main error is that -lopencv_core isn't found, which is strange because I have the dylib installed in a place where pkg-config can find it. Any thoughts?

from opencv-haar-classifier-training.

mrnugget avatar mrnugget commented on July 3, 2024

I actually have no idea. You're basically running the same setup as I do.

But it's not pkg-config that needs to find the library, it's g++ that needs access. pkg-config only provides us with the flags to pass to g++ so it can find the libraries.

Just a quick guess: is your g++ command correctly constructed?

from opencv-haar-classifier-training.

mrnugget avatar mrnugget commented on July 3, 2024

I'm closing this for now.

from opencv-haar-classifier-training.

bogong17 avatar bogong17 commented on July 3, 2024

Hey guys, I got the same error..
Did you fix it?
Thank you so much///

from opencv-haar-classifier-training.

arturgrigor avatar arturgrigor commented on July 3, 2024

I had lots of issues with building the mergevec tool on OS X Yosemite but I've managed to fix them like this:

g++ `pkg-config --libs --cflags opencv` -I. -I/usr/local/Cellar/opencv/2.4.12_2/include/opencv -I/usr/local/Cellar/opencv/2.4.12_2/include -o mergevec mergevec.cpp\
  cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp\
  cvhaartraining.cpp cvsamplesoutput.cpp\
  -L/usr/local/Cellar/opencv/2.4.12_2/lib\
  -lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect

Notes

  • The opencv package has been installed using Homebrew and the installed version was 2.4.12
  • You need to run export DYLD_LIBRARY_PATH=/usr/local/lib in case you run into this error ld: library not found for -llibtbb.dylib
  • -I/usr/local/Cellar/opencv/2.4.12_2/include/opencv -I/usr/local/Cellar/opencv/2.4.12_2/include is needed in case of this error mergevec.cpp:1:10: fatal error: 'cv.h' file not found
  • You also need to include the cvsamplesoutput.cpp in case you run into this problem JpgDatasetGenerator::JpgDatasetGenerator(char const*) in cvhaartraining-8f5a1b.o

from opencv-haar-classifier-training.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.