Ask Your Question

Matheusft's profile - activity

2019-03-04 13:04:38 -0600 received badge  Popular Question (source)
2017-09-24 16:51:56 -0600 received badge  Famous Question (source)
2017-03-17 12:45:31 -0600 answered a question ERROR using opencv_contrib with Python 3.x

After trying hundreds of different combinations it finally worked!!!

I'm not sure which was the modification responsible for making it work, since in my last attempt I've modified two things:

  1. Instead of /Users/MatheusTorquato/OpenCV/opencv_contrib/modules I've used ~/OpenCV/opencv_contrib/modules (I can't really spot the difference)
  2. I've added ~/OpenCV/main after the "opencv_contrib/modules" path in the OPENCV_EXTRA_MODULES_PATH resulting in:

    -D OPENCV_EXTRA_MODULES_PATH= ~/OpenCV/opencv_contrib/modules ~/OpenCV/main
    

Where ~/OpenCV/opencv_contrib/modules is the opencv_contrib/modules path and ~/OpenCV/main is the OpenCV source directory path.

I've found this information in the file README.md in the opencv_contrib folder:

Here is the CMake command for you:


$ cd <opencv_build_directory>
$ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>
$ make -j4
2017-03-17 08:38:43 -0600 received badge  Enthusiast
2017-03-16 09:38:30 -0600 commented question ERROR using opencv_contrib with Python 3.x

Ok, I always do it.

2017-03-16 09:14:01 -0600 commented question ERROR using opencv_contrib with Python 3.x

Ok, I'm sorry for that. I'm not able to the edit the comment anymore.

2017-03-16 09:00:00 -0600 commented question ERROR using opencv_contrib with Python 3.x

I really can't see how my path can be wrong. See Image

2017-03-15 23:29:08 -0600 commented question ERROR using opencv_contrib with Python 3.x

They were like these before. I've put both of them inside a folder in an attempt to use relative folder paths. As you might guess, It didn't work. Thanks anyway for your suggestion.

2017-03-15 12:55:42 -0600 commented question xfeatures2d in Opencv 3.2-dev

I have a similar question. Asked it with more details in here

2017-03-15 12:40:26 -0600 asked a question ERROR using opencv_contrib with Python 3.x

Whenever I try to use something from the opencv_contrib I get an error:


Ex1: In the command line

python
>>> import cv2
>>> help(cv2.xfeatures2d)
AttributeError: module 'cv2' has no attribute 'xfeatures2d'

Ex2: Trying to run the following code (just the first few lines)

import cv2
import sys

if __name__ == '__main__' :

        tracker = cv2.Tracker_create("BOOSTING")

I Get

Traceback (most recent call last):
  File "tracking.py", line 6, in <module>
    tracker = cv2.Tracker_create("BOOSTING")
AttributeError: module 'cv2' has no attribute 'Tracker_create'

My seetings for the cmake were:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH= /Users/MatheusTorquato/OpenCV/opencv_contrib/modules \
-D PYTHON3_LIBRARY=/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6.dylib \
-D PYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.6.0_1/Frameworks/Python.framework/Versions/3.6/include/python3.6m/ \
-D PYTHON3_EXECUTABLE=$VIRTUAL_ENV/bin/python \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D BUILD_EXAMPLES=ON \
-D BUILD_opencv_cvv=OFF\
-D BUILD_opencv_adas=OFF ..

Everything looks fine.

  • Configuring: Ok - File
  • Making: Ok - File
  • Installing: Ok - File

  • Python Version – 3.6.0
  • OpenCV Version – ‘3.2.0-dev’
  • Operating System - macOS Sierra

I've installed everything using this tutorial

Any ideas?

Regards,

Matheus Torquato

2017-02-12 15:27:40 -0600 received badge  Notable Question (source)
2016-11-01 10:01:38 -0600 received badge  Popular Question (source)
2016-03-30 05:23:07 -0600 marked best answer Cascade Training Error OpenCV 3.1 - Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.

"Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters."

I'm really struggling on this error. It's taking me forever to solve it.

I've already read

and I'm doing the same as the following tutorials:

I couldn't find any real solution, hence I'm updating the question.

I'm using OpenCV 3.1.0 with Python on a Macbook with 8 GB of memory (Unix).

Here you can find the folder structure and files of my project. (Negative and Positive folders, the .vec file, and a sample of both images database).

I have in total 500(640 × 240) positive images and 2988(640 × 480) negative images.

The command that I used to create de .vec file (at the directory Positivas) was :

opencv_createsamples -vec Placas_Positivas.vec -info Training.txt -num 500 -w 200 -h 50 (just like as here)

The command that I'm using (at the directory Cascade_Training) is:

opencv_traincascade -data Data -vec Positivas/Placas_Positivas.vec -bg Negativas/Training_Negatives.txt -numPos 400 -numNeg 2500 -numStages 15 -w 200 -h 50 -featureType LBP

and NO MATTER WHAT I DO, I always see the result in the following image: image description

Any help?

2016-03-30 05:23:07 -0600 received badge  Scholar (source)
2016-03-29 22:41:53 -0600 commented answer Cascade Training Error OpenCV 3.1 - Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.

Thank you for your answer. Its is very complete and detailed. Apparently I solved the problem that I described in this topic by changing the path of the image in the *.txt file in the Negative folder from:

"Images/UMD_001.jpg"

to

"/Users/My_PC_Name/Desktop/Image_Database/Negatives/Images/UMD_001.jpg"

Now, my training is able to read the *.txt file from the negative folder. However I still need to fix my training time as you described, but this is another question.

Would you be able to answer that too?

I'm using the size 200x50. Why? I don't know, I'm a beginner =) It's just a dimension that came into my mind.

How will the Height and Width of the output samples influence on the results? What if I use 60x15 instead of 200x50? I couldn't find any answer to that

2016-03-29 11:27:22 -0600 commented answer Cascade Training Error OpenCV 3.1 - Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.

Ok, sorry for that. The Positive Images folder now has 500 images.

I'll have a look on what you said about the *.txt files and post the outcome later.