0
입력 이미지와 데이터베이스의 이미지가 일치하는 앱을 만들고 있습니다.특징 두 이미지 간의 일치하는 일치율
어쨌든이 코드를 사용하고 있습니다 :
나는 내가 원하는 같은 일치하는 두 이미지 사이의 일치율을 알고있다,하지만 좋은 경기를 생산하고 계산 할 수 있어요String path = Environment.getExternalStorageDirectory().getAbsolutePath();
Bitmap objectbmp = BitmapFactory.decodeFile(path+"/Sample/Template.jpg");
Bitmap scenebmp = BitmapFactory.decodeFile(path+"/Sample/Input.jpg");
Mat object = new Mat(); //from the database
Mat scene = new Mat(); //user's input image
// convert bitmap to MAT
Utils.bitmapToMat(objectbmp, object);
Utils.bitmapToMat(scenebmp, scene);
//Feature Detection
FeatureDetector orbDetector = FeatureDetector.create(FeatureDetector.ORB);
DescriptorExtractor orbextractor = DescriptorExtractor.create(DescriptorExtractor.ORB);
MatOfKeyPoint keypoints_object = new MatOfKeyPoint();
MatOfKeyPoint keypoints_scene = new MatOfKeyPoint();
Mat descriptors_object = new Mat();
Mat descriptors_scene = new Mat();
//Getting the keypoints
orbDetector.detect(object, keypoints_object);
orbDetector.detect(scene, keypoints_scene);
//Compute descriptors
orbextractor.compute(object, keypoints_object, descriptors_object);
orbextractor.compute(scene, keypoints_scene, descriptors_scene);
//Match with Brute Force
MatOfDMatch matches = new MatOfDMatch();
DescriptorMatcher matcher;
matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
matcher.match(descriptors_object, descriptors_scene, matches);
double max_dist = 0;
double min_dist = 100;
List<DMatch> matchesList = matches.toList();
//-- Quick calculation of max and min distances between keypoints
for(int i = 0; i < descriptors_object.rows(); i++)
{ double dist = matchesList.get(i).distance;
if(dist < min_dist) min_dist = dist;
if(dist > max_dist) max_dist = dist;
}
LinkedList<DMatch> good_matches = new LinkedList<DMatch>();
for(int i = 0; i < descriptors_object.rows(); i++)
{ if(matchesList.get(i).distance <= 3*min_dist)
{ good_matches.addLast(matchesList.get(i));
}
}
:
입력 - Template1 = 35 % 입력 - 템플릿 2 = 12 % .....................
어떻게하는가?