Ask Your Question

SteveBorges's profile - activity

2015-08-05 08:09:59 -0600 asked a question Essential matrix 6x3 (expecting 3x3)

After calling findEssentialMat() function:

essMatrix = findEssentialMat( points1, points2, 1.0, Point2d( 0, 0 ), RANSAC, 0.999, 3.0  );

I get 6x3 matrix. Next I would like to use recoverPose() function which requires 3x3 essential matrix as an input. Therefore an "assertion fail" error shows up. Why is my essential matrix not 3x3 and what can I do?

Console output:

points1:
[496.24762, 215.24762;
 496, 503.5;
 783.99518, 503.50491;
 783.75238, 215.24762;
 639.99756, 359.25223]
points2:
[-256.5, -256.5;
 -256.5, 256.5;
 256.5, 256.5;
 256.5, -256.5;
 0, 0]

    essMatrix.rows() = 6
    essMatrix.cols() = 3
    essMatrix:
    [1.495439070665867e-08, -0.0004217709137173954, 0.3456540852386693;
     0.0004236403216190259, -2.044583490213094e-06, -0.6168655278608869;
     -0.346120572048197, 0.6166038972684622, -2.663582069025173e-06;
     -1.286638357093461e-09, 0.001502552560190315, -0.3456533986887974;
     -0.001504059448579667, -2.06088959516535e-06, 0.6168642186647175;
     -0.3461198575633839, 0.6166026176096243, -2.118298495767899e-07]

OpenCV Error: Assertion failed (E.cols == 3 && E.rows == 3) in decomposeEssentialMat, file /.../opencv-3.0.0-rc1_stable/modules/calib3d/src/five-point.cpp, line 597
terminate called after throwing an instance of 'cv::Exception' what():  /.../opencv-3.0.0-rc1_stable/modules/calib3d/src/five-point.cpp:597: error: (-215) E.cols == 3 && E.rows == 3 in function decomposeEssentialMat
2015-06-16 07:08:17 -0600 received badge  Enthusiast
2015-06-09 02:43:16 -0600 received badge  Nice Question (source)
2015-06-08 08:11:29 -0600 received badge  Student (source)
2015-06-08 08:08:34 -0600 received badge  Editor (source)
2015-06-08 08:06:22 -0600 asked a question markers detection

Greetings everyone! :)

I'm working on the solution that will detect markers in the image. I'd like to ask which method available in OpenCV will be a good choice for this task. The detection should be fast enough to work in real time on a modern computer.

After a quick research I've decided to use markers similar to those used in car crash-tests.

image description

The method should be able to detect multiple markers which are visible from a slight perspective and also with some rotation - just like in the following example:

image description

My first idea was to use the cascadeclassifier. I've started with creating positive samples .vec file using:

./opencv_createsamples -vec positive_samples/vec/positive_images.vec -img positive_samples/marker.png -bg negative_samples/negative_images.dat -num 1020 -bgcolor -1 -bgthresh 0 -maxidev 40 -maxxangle 0.6 -maxyangle 0.6 -maxzangle 0.2 -show -w 24 -h 24

I used "-bgcolor -1 -bgthresh 0" to avoid making any part of the image transparent. Parameters "-maxxangle 0.6 -maxyangle 0.6 -maxzangle 0.2" gives rotation and distortion variance that seems to be quite enough.

Negative images dataset was taken from the SUN2012 - I've chosen 1000 images from this set.

Then I've done some trainings:

./opencv_haartraining -data cascade -vec positive_samples/vec/positive_images.vec -bg negative_samples/negative_images.dat -npos 1000 -nneg 1000 -nstages 10 -nsplits 2 -mem 15000 -nonsym -minhitrate 0.999 -maxfalsealarm 0.5 -mode ALL -minpos 200 -w 24 -h 24

and tests, however the results were not satisfying - in example: very low detection rate of markers seen in live camera image.

After all, I've also tried training cascadeclassifier to detect my face and in this case results were much better.

So my question is whether cascadeclassifier is a good choice for recognizing simple markers? And if yes - what values of the training parameters would give good detection results? Or maybe some other detecting method is better for such task?

Thank you in advance for your help.

Below is the log from one of many cascade trainings I've done.

./opencv_haartraining \
-data cascade \
-vec positive_samples/vec/positive_images.vec \
-bg negative_samples/negative_images.dat \
-npos 1000 \
-nneg 1000 \
-nstages 10 \
-nsplits 2 \
-maxtreesplits 10 \
-mem 15000 \
-nonsym \
-minhitrate 0.999 \
-maxfalsealarm 0.5 \
-mode ALL \
-minpos 200 \
-w 24 -h 24


Data dir name: cascade
Vec file name: positive_samples/vec/positive_images.vec
BG  file name: negative_samples/negative_images.dat, is a vecfile: no
Num pos: 1000
Num neg: 1000
Num stages: 10
Num splits: 2 (tree as weak classifier)
Mem: 15000 MB
Symmetric: FALSE
Min hit rate: 0.999000
Max false alarm rate: 0.500000
Weight trimming: 0.950000
Equal weights: FALSE
Mode: ALL
Width: 24
Height: 24
Applied boosting algorithm: GAB
Error (valid only for Discrete and Real AdaBoost): misclass
Max number of splits in tree cascade: 10
Min number of positive samples per cluster: 200
Required leaf false alarm rate: 8.87784e-05

Tree Classifier
Stage
+---+
|  0|
+---+


Number of features used : 261600

Parent node: NULL

*** 1 cluster ***
POS: 1000 1000 1 ...
(more)