001/******************************************************************************* 002 * This software is provided as a supplement to the authors' textbooks on digital 003 * image processing published by Springer-Verlag in various languages and editions. 004 * Permission to use and distribute this software is granted under the BSD 2-Clause 005 * "Simplified" License (see http://opensource.org/licenses/BSD-2-Clause). 006 * Copyright (c) 2006-2016 Wilhelm Burger, Mark J. Burge. All rights reserved. 007 * Visit http://imagingbook.com for additional details. 008 *******************************************************************************/ 009 010package imagingbook.pub.sift; 011 012/* 013 * Make dynamic such that the match can contain an arbitrary sequence of features. 014 */ 015 016public class SiftMatch3 implements Comparable<SiftMatch3> { 017 018 final SiftDescriptor descriptor1, descriptor2, descriptor3; 019 final double distance; 020 021 public SiftMatch3(SiftDescriptor descriptor1, SiftDescriptor descriptor2, SiftDescriptor descriptor3, double distance) { 022 this.descriptor1 = descriptor1; 023 this.descriptor2 = descriptor2; 024 this.descriptor3 = descriptor3; 025 this.distance = distance; 026 } 027 028 public SiftDescriptor getDescriptor1() { 029 return descriptor1; 030 } 031 032 public SiftDescriptor getDescriptor2() { 033 return descriptor2; 034 } 035 036 public SiftDescriptor getDescriptor3() { 037 return descriptor3; 038 } 039 040 public double getDistance() { 041 return distance; 042 } 043 044 public int compareTo(SiftMatch3 match2) { 045 if (this.distance < match2.distance) 046 return -1; 047 else if (this.distance > match2.distance) 048 return 1; 049 else 050 return 0; 051 } 052 053 public String toString() { 054 return String.format("match %.2f", this.distance); 055 } 056 057}