/**
* Analyzes a scene for a target object.
*
* @param scene The scene to be analyzed as a GRAYSCALE matrix
* @param analysis The target object's analysis from analyzeObject
* @return A complete scene analysis
*/
public SceneAnalysis analyzeScene(Mat scene, ObjectAnalysis analysis) throws IllegalArgumentException {
MatOfKeyPoint keypointsScene = new MatOfKeyPoint();
//DETECT KEYPOINTS in scene
detector.detect(scene, keypointsScene);
//EXTRACT KEYPOINT INFO from scene
Mat descriptorsScene = new Mat();
extractor.compute(scene, keypointsScene, descriptorsScene);
if (analysis == null) {
throw new IllegalArgumentException("Analysis must not be null!");
}
if (analysis.descriptors.cols() != descriptorsScene.cols() || analysis.descriptors.type() != descriptorsScene.type()) {
throw new IllegalArgumentException("Object and scene descriptors do not match in cols() or type().");
}
MatOfDMatch matches = new MatOfDMatch();
matcher.match(analysis.descriptors, descriptorsScene, matches);
//FILTER KEYPOINTS
/*double max_dist = 0, min_dist = 100;
for(int i = 0; i < objectAnalysis.descriptors.rows(); i++) {
double dist = matches.get;
if(dist < )
}*/
//STORE SCENE ANALYSIS
return new SceneAnalysis(keypointsScene, descriptorsScene, matches, scene);
}
ObjectDetection.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:FTC2016
作者:
评论列表
文章目录