Ask Your Question

8mike's profile - activity

2013-11-10 16:14:31 -0600 asked a question How to view positives during Haar Cascade classification

Hello, everyone, I have trained my own classifier in Opencv and when I run it a get kind of bad results. My goal is to use the Haar features as a guideline so I'd like to view the positives not after the entire cascade classifier has been executed but in each step, after every feature. Is it then, possible to tell the detector to stop at that feature or do I have to manually truncate the xml file containing the features thresholds? Thank you

2013-11-01 08:32:49 -0600 asked a question Trouble installing Opencv on eclipse kepler on windows

i am trying to use opencv with Eclipse. i downloaded the latest version, i have it in my C: directory. I included "C:\opencv\build\include\" in the include under gcc c++ compiler and all the libraries inside the mingw linker, such as opencv_core246 and added "C:\opencv\build\x86\mingw\lib" in the library search path. If i run my test code eclipse crashes at the reading.

#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <stdlib.h>
using namespace cv;
using namespace std;
int main( int argc, char** argv ){
  Mat image;
  image = imread( "a.jpg", 0 );
  if (image.data == NULL)
  {
      cout << "No image found! Check path." << endl;
      return 1;//ERROR
  }
}
2012-10-11 11:52:41 -0600 received badge  Editor (source)
2012-10-11 11:51:45 -0600 asked a question features2d usage issue (in mexopencv)

Hello, i am using opencv in matlab through the library mexopencv. The creator of the library said that my issues should be asked directly to the creators of opencv so here i am and thanks in advance for your help.

I am trying different algorithms for keypoints detection, description and matching. My problem is that the results are not satisfying even if i directly use the same procedure shown in your tutorial with the same image (bastoncini di pesce box). So here is the code i am using:

a = imread('scene.pgm');
b = imread('box.pgm');

detector = cv.FeatureDetector('SURF');
k1 = detector.detect(a);
k2 = detector.detect(b);

extractor = cv.DescriptorExtractor('SURF');
d1 = extractor.compute(a, k1);
d2 = extractor.compute(b, k2);

matcher = cv.DescriptorMatcher('FlannBased');
matches = matcher.match(d1, d2);

n = numel(matches);
maxDist = 0; minDist = Inf;
for i = 1:n
  if(matches(i).distance > maxDist) maxDist = matches(i).distance; end
  if(matches(i).distance < minDist) minDist = matches(i).distance; end
end

cont = 1;
i = 1;
while(i < n)
  if(matches(i).distance <= minDist*2)
    goodMatches(cont) = matches(i);
    cont = cont + 1;
  end
  i = i + 1;
end

n = numel(goodMatches);
for i=1:n
  srcPoints(1,i,1) = k1(goodMatches(i).queryIdx + 1).pt(1);
  srcPoints(1,i,2) = k1(goodMatches(i).queryIdx + 1).pt(2);
  dstPoints(1,i,1) = k2(goodMatches(i).trainIdx + 1).pt(1);
  dstPoints(1,i,2) = k2(goodMatches(i).trainIdx + 1).pt(2);
end

[H, ok] = cv.findHomography(srcPoints, dstPoints, 'Method', 'Ransac');

//project corners of image a in b
[h,l] = size(b);
p1 = H * [0; 0; 1];
p2 = H * [l; 0; 1];
p3 = H * [l; h; 1];
p4 = H * [0; h; 1];
x3 = [p1 p2 p3 p4];

inliers = [];
cont = 1;
for i = 1:numel(ok)
  if(ok(i) == 1)
    inliers(cont) = i;
    cont = cont + 1;
  end
end

for j = 1:numel(inliers)
  newMatches(j) = goodMatches(inliers(j));
end

imshow(cv.drawMatches(a, k1, b, k2, newMatches));

Then i plot the corners on b. Here are the results:

  • Using minDist*2 as threshold:

using minDist*2 as threshold

  • Corner points plotted on b:

corner points plotted on b

  • Using minDist*3 as threshold:

using minDist*3 as threshold

  • No threshold:

no threshold