Ask Your Question

sleo5's profile - activity

2017-08-30 14:25:12 -0500 received badge  Enthusiast
2017-08-16 05:17:44 -0500 answered a question Finding white circles only

If you already know there is just one circle on your video and it is white, you don't have to convert the frame to HSV. Circle Hough Transformation it's enough. But if there are a lot of noises, you have to optimize your detection playing with your parameters. Take a look at the c++ code here. Maybe it will help you to understand the approach. (I've never used Python, so I can't implement an example for you).

good luck

2017-08-13 03:56:24 -0500 answered a question Android Canny problem No implementation found

It seems your parameter's type are wrong. the error message report you used long values, i'm not sure that it is correct. What is the type of img and edges in your code?

You should have something like that in your code:

Mat img = new Mat(); // img it's not a long value but a matrix
2017-08-11 06:12:50 -0500 received badge  Supporter (source)
2017-08-01 11:57:40 -0500 received badge  Student (source)
2017-06-21 10:57:09 -0500 received badge  Editor (source)
2017-06-21 10:56:36 -0500 asked a question Own Multi-class Object Detection/Recognition - But how ?????

I try to learn how I can implement my own algorithm to recognize traffic signs using OpenCV.


I wanted to use HOG descriptors but I think I missunterstood the implementation process.

After computing the HOG descriptors of my classes data (15 classes for the moment), I trained a SVM to classify the values.

Then I used the generated support vectors for detecting the classes objects in a given frame by calling the method HOGDescriptor.detectMultiScale.


It's surely basic for a lot of you, but I want to know:

  • what is the best way, using OpenCV to realize the traffic sign recognition in real time?

  • what is the differences between classification and regression? because I have heard SVM can both

PLEASE! Can you explain it STEP BY STEP or show me a tutorial or a report that tell me all the secrets about Detection/Recognition (with OpenCV)?

Thank you

2017-06-21 07:21:45 -0500 received badge  Scholar (source)
2017-06-21 06:40:31 -0500 commented answer HOG descriptor - setSVMDetector throws confusing error

@berak thanks a lot

I just feel like I get HOG and SVM all the time really bad.

I though I have to use the HOG descriptor for the classification in SVM. When the classification is done, I can compute a detection using the generated vectors of SVM hogDescriptor.setSVMDetector(svm->getSupportVector()) , and call the method HOGDescriptor.detectMultiScale, which compares the given data (current Mat) to the saved one in the support vectors and give the areas that match (with class data). Am I wrong?

I was full of hope as I found HOG - object detection and handwritten classification

2017-06-21 04:17:59 -0500 commented answer HOG descriptor - setSVMDetector throws confusing error

thank you @berak

I though SVM in OpenCV also computes multi-class classification, there are a few samples about that and the results of the predict function are for 2-class regression 1 or -1, in case of multi-class the results could be 0,1, 2, 3,...,14 depending on the number of classes.

  • What would you recommand to execute a multi-class classification using OpenCV?

  • Do I implement my code with wrong parameters?

2017-06-20 16:38:00 -0500 commented question HOG descriptor - setSVMDetector throws confusing error

@berak thank you for your answer, but what is a -rho and how do I can "add" it?

2017-06-20 13:48:58 -0500 asked a question HOG descriptor - setSVMDetector throws confusing error

I'm not an expert in machine learning and I don't understand the error that my code throws.

So I train a svm with 15 classes. everything is fine.

// Set up SVM's parameters
Ptr<SVM> svm = SVM::create();    
svm->setType(SVM::C_SVC);
svm->setKernel(SVM::POLY);
svm->setC(100); 
svm->setTermCriteria(TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 100, 1e-6));
svm->setDegree(1);

// Train the SVM with given parameters
Ptr<TrainData> td = TrainData::create(training_mat, ROW_SAMPLE, labelsMat);
svm->train(td);    
svm->save("output/xml/svm_filename.xml");

I implement the HOG descriptor like that HOGDescriptor hog(Scalar(16,16), Scalar(8,8), Scalar(4,4), Scalar(4,4), 9);

The Problem is that the program crashed when I call this method the setSVMDetector:

Ptr<SVM> svm = SVM::create();
svm = svm->load("output/xml/svm_filename.xml");
hog.setSVMDetector(svm->getSupportVectors());

the error is

OpenCV Error: Assertion failed (d == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0)) in create, file /home/leo/extra/opencv-3.2.0/modules/core/src/matrix.cpp, line 2410

the same code is working perfectly when I only train the svm with 2 classes.

I don't know what this error message means, I've already looked around, and I found nothing.

Can someone please help me?

2017-06-08 18:03:41 -0500 commented question Android App don't load SVM trained (on C++) file for recognition

@berak I'm the one who post the question but I can't sign in with sleo, that's why I create a new user account.

svm->load("images/svm_filename.xml");

the function is working fine and gives satisfying result in C++. but I want to load the xml file in Android like this

SVM svm = SVM.load("svm_filename.xml")

using the OpenCV4Android library (OpenCV 3.2)