Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

@Mathieu Barnachon
je réalise un projet android pour la reconnaissance d'un objet connu img1 voici les étapes :

descriptors = new Mat(); keypoints = new MatOfKeyPoint(); detector = FeatureDetector.create(FeatureDetector.ORB); detector.detect(img1, keypoints); descriptor = DescriptorExtractor.create(DescriptorExtractor.ORB); descriptor.compute(img1, keypoints, descriptors); matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);

         ColorDetection.cvt_YUVtoRGBtoHSV(mYuv,mGraySubmat);
      MatOfKeyPoint mKeyPoints = new MatOfKeyPoint();
    MatOfDMatch  matches = new MatOfDMatch();

      detector.detect(mGraySubmat, mKeyPoints);
      descriptor.compute(mGraySubmat, mKeyPoints, mIntermediateMat);
      Log.i("matches", matches.size()+"");
      matcher.match(mIntermediateMat, descriptors, matches);
      Log.i("matches", matches.size()+"");

    mIntermediateMat2.create(resultSize, CvType.CV_8UC1);

Features2d.drawMatches(img1, keypoints , mGraySubmat, mKeyPoints, matches, mIntermediateMat2);

Imgproc.resize(mIntermediateMat2, mIntermediateMat2, mRgba.size()); Imgproc.cvtColor(mIntermediateMat2, mRgba, Imgproc.COLOR_RGBA2BGRA, 4); Utils.matToBitmap(mRgba, bmp);

when the last steps Features2d.drawMatches the application is not responding (I tested well) my question is: when I extract matches (MatOfDMatch) I want to draw just the keypoints of image source in the scene video as shown in this link but I can not translate properly in java http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography

when I get to the stage of drawing, I just want to draw a square, for example, the object recognition

@Mathieu Barnachon
je réalise un projet android pour la reconnaissance d'un objet connu img1 voici les étapes :

descriptors = new Mat();
 keypoints = new MatOfKeyPoint();
 detector = FeatureDetector.create(FeatureDetector.ORB);
 detector.detect(img1, keypoints);
 descriptor = DescriptorExtractor.create(DescriptorExtractor.ORB);
 descriptor.compute(img1, keypoints, descriptors);
 matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);

DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
 ColorDetection.cvt_YUVtoRGBtoHSV(mYuv,mGraySubmat);
 MatOfKeyPoint mKeyPoints = new MatOfKeyPoint();
 MatOfDMatch matches = new MatOfDMatch();
 detector.detect(mGraySubmat, mKeyPoints);
 descriptor.compute(mGraySubmat, mKeyPoints, mIntermediateMat);
 Log.i("matches", matches.size()+"");
 matcher.match(mIntermediateMat, descriptors, matches);
 Log.i("matches", matches.size()+"");
 mIntermediateMat2.create(resultSize, CvType.CV_8UC1);

Features2d.drawMatches(img1, keypoints , mGraySubmat, mKeyPoints, matches, mIntermediateMat2);

mIntermediateMat2);

Imgproc.resize(mIntermediateMat2, mIntermediateMat2, mRgba.size()); Imgproc.cvtColor(mIntermediateMat2, mRgba, Imgproc.COLOR_RGBA2BGRA, 4); Utils.matToBitmap(mRgba, bmp);

bmp);

when the last steps Features2d.drawMatches the application is not responding (I tested well) my question is: when I extract matches (MatOfDMatch) I want to draw just the keypoints of image source in the scene video as shown in this link but I can not translate properly in java http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography

when I get to the stage of drawing, I just want to draw a square, for example, the object recognition