opencv keypoint and histogram matching [closed]

asked 2016-10-06 16:16:05 -0600

I'm developing a project in android for image comparison. The images can be in any scale / rotation. I did some tests with my current project, but the results are not good. I thought to do beyond the keypoints matching, a histogram matching. Can anyone help me?

Images for comparison (example):

Image1:

image description

Image2:

image description

My Code:

FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB);
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.ORB);
DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);

Mat img1 = Imgcodecs.imread(teste,Imgcodecs.CV_LOAD_IMAGE_COLOR);
Mat descriptors1 = new Mat();
MatOfKeyPoint keypoints1 = new MatOfKeyPoint();

detector.detect(img1, keypoints1);
extractor.compute(img1, keypoints1, descriptors1);


Mat img2 = Imgcodecs.imread(file,Imgcodecs.CV_LOAD_IMAGE_COLOR);
Mat descriptors2 = new Mat();
MatOfKeyPoint keypoints2 = new MatOfKeyPoint();

detector.detect(img2, keypoints2);
extractor.compute(img2, keypoints2, descriptors2);

MatOfDMatch matches = new MatOfDMatch();
matcher.match(descriptors1,descriptors2,matches);

int distLimit = 80;
List<DMatch> matchesList = matches.toList();
List<DMatch> goodMatches= new ArrayList<DMatch>();

for(int i=0; i<matchesList.size(); i++) {
    if(matchesList.get(i).distance <= distLimit) {
        goodMatches.add(matches.toList().get(i));
    }
}

return goodMatches.size();
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-11 13:02:53.849070