Giter Site home page Giter Site logo

Comments (10)

mrnugget avatar mrnugget commented on July 23, 2024

Some questions to help with debugging:

  1. Does the mergevec.cpp file exist?
  2. Do you have libtbb installed?
  3. Which OpenCV version are you using?

from opencv-haar-classifier-training.

ericastevens avatar ericastevens commented on July 23, 2024

The mergevec.cpp file does not exist (to the best of my knowledge).
I am not sure how to check if libtbb is installed, but I want to lean towards no.
I am using OpenCV 2.4.9.
(Thank you for your patience, this is my first time working with OpenCV. I'm a new Swift developer)

from opencv-haar-classifier-training.

ericastevens avatar ericastevens commented on July 23, 2024

I thought that the mergevec.cpp would be created automatically by following the steps in the tutorial, should I have added it manually at some point?

from opencv-haar-classifier-training.

mrnugget avatar mrnugget commented on July 23, 2024

I just realized that you're running the outdated commands from the blog post. Try following the steps in the current version of the README in this repo. It contains a Python version of the mergevec.cpp file.

from opencv-haar-classifier-training.

ericastevens avatar ericastevens commented on July 23, 2024

So, I think I used code from this repo's README as well as from the outdated blog. This is a snippet from my history:

  387  cd opencv-haar-classifier-training/
  388  cp src/mergevec.cpp ~/opencv-2.4.9/apps/haartraining
  389  python ./tools/mergevec.py -v samples/ -o samples.vec
  390  ls
  391  opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt   -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000   -numNeg 600 -w 80 -h 40 -mode ALL -precalcValBufSize 1024   -precalcIdxBufSize 1024 -featureType LBP
  392  cd ~/opencv-2.4.9/samples/c
  393  chmod +x build_all.sh
  394  ./build_all.sh

But, I do have a mergevec.py file after executing the steps as outlined in the README.

I'm confused about what to do next. When I run ./build_all.sh I get all the errors I sent as a snippet above. I tried to follow the steps in this link: Avoid recompiling opencv with mergevec.cpp. How do I access my finished classifier (and test it in an Xcode project)?

from opencv-haar-classifier-training.

mrnugget avatar mrnugget commented on July 23, 2024

So what exactly is failing now? Only build_all.sh or creating the classifier itself?

from opencv-haar-classifier-training.

ericastevens avatar ericastevens commented on July 23, 2024

It seems as though only '''build_all.sh''' is failing. The training seemed to have completed successfully after about 2 hours

from opencv-haar-classifier-training.

mrnugget avatar mrnugget commented on July 23, 2024

That means you can use your classifier with "any other" project that uses one, right? I'm sorry. I don't know more about why compiling OpenCV fails. But I'd say installing libtbb is a requirement.

from opencv-haar-classifier-training.

ericastevens avatar ericastevens commented on July 23, 2024

Okay so this snippet fixed the spelling error that was preventing the compiler from accessing the proper libraries:

g++ -L/usr/local/lib `pkg-config --libs --cflags opencv | sed 's/libtbb\.dylib/tbb/'`\
  -I. -o mergevec samples.vec  cvboost.cpp cvcommon.cpp cvsamples.cpp\
  cvhaarclassifier.cpp cvhaartraining.cpp cvsamplesoutput.cpp -lopencv_core\
  -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect

I had to add cvsamplesoutput.cpp/h and another file called ioutput.h in order for this to work (Downloaded from https://github.com/apc-llc/opencv-2.4.10). In the code above I used the samples.vec file, and that is what is generating the following error:

warning: ignoring file samples.vec, file was built for unsupported file format ( 0x9B 0x05 0x00 0x00 0x80 0x0C 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xA1 0x00 0xA8 ) which is not the architecture being linked (x86_64): samples.vec
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64

from opencv-haar-classifier-training.

mrnugget avatar mrnugget commented on July 23, 2024

Looks like the samples.vec was built for another architecture, meaning it wasn't compiled/generated by you. Sorry, I don't have anything more to add!

Also, I'm sorry to say, but the problems looks more like a OpenCV problem than a problem that has to do with this repository.

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.