001package org.opencv.core; 002 003//C++: class DMatch 004 005/** 006 * Structure for matching: query descriptor index, train descriptor index, train 007 * image index and distance between descriptors. 008 */ 009public class DMatch { 010 011 /** 012 * Query descriptor index. 013 */ 014 public int queryIdx; 015 /** 016 * Train descriptor index. 017 */ 018 public int trainIdx; 019 /** 020 * Train image index. 021 */ 022 public int imgIdx; 023 024 // javadoc: DMatch::distance 025 public float distance; 026 027 // javadoc: DMatch::DMatch() 028 public DMatch() { 029 this(-1, -1, Float.MAX_VALUE); 030 } 031 032 // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _distance) 033 public DMatch(int _queryIdx, int _trainIdx, float _distance) { 034 queryIdx = _queryIdx; 035 trainIdx = _trainIdx; 036 imgIdx = -1; 037 distance = _distance; 038 } 039 040 // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _imgIdx, _distance) 041 public DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) { 042 queryIdx = _queryIdx; 043 trainIdx = _trainIdx; 044 imgIdx = _imgIdx; 045 distance = _distance; 046 } 047 048 public boolean lessThan(DMatch it) { 049 return distance < it.distance; 050 } 051 052 @Override 053 public String toString() { 054 return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx 055 + ", imgIdx=" + imgIdx + ", distance=" + distance + "]"; 056 } 057 058}