1 /* 2 * Copyright (C) 2017 Alberto Irurueta Carro (alberto@irurueta.com) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.irurueta.ar.sfm; 18 19 import com.irurueta.algebra.Matrix; 20 import com.irurueta.geometry.Point3D; 21 22 import java.io.Serializable; 23 24 /** 25 * Contains data of a reconstructed 3D point. 26 */ 27 public class ReconstructedPoint3D implements Serializable { 28 29 /** 30 * Default quality score value. 31 */ 32 public static final double DEFAULT_QUALITY_SCORE = 1.0; 33 34 /** 35 * ID to identify this instance. This is useful in case that this data is 36 * stored in some sort of database and must be set externally. 37 */ 38 private String id; 39 40 /** 41 * Coordinates of reconstructed 3D point. 42 */ 43 private Point3D point; 44 45 /** 46 * Indicates whether reconstructed point is an inlier or not. 47 */ 48 private boolean inlier; 49 50 /** 51 * Quality score of sampled point. The larger the value, the better the 52 * quality. This is used for robust estimators such as PROSAC or PROMedS. 53 * This value is typically obtained from algorithms determining point 54 * correspondences. 55 */ 56 private double qualityScore = DEFAULT_QUALITY_SCORE; 57 58 /** 59 * Covariance of reconstructed point. This can be computed during point 60 * triangularization. 61 */ 62 private Matrix covariance; 63 64 /** 65 * Color data of reconstructed point (i.e. RGB or YUV values), if available. 66 */ 67 private PointColorData colorData; 68 69 /** 70 * Gets id to identify this instance. This is useful in case that this data 71 * is stored in some sort of database and must be set externally. 72 * 73 * @return id to identify this instance. 74 */ 75 public String getId() { 76 return id; 77 } 78 79 /** 80 * Sets id to identify this instance. This is useful in case that this data 81 * is stored in some sort of database and must be set externally. 82 * 83 * @param id id to identify this instance. 84 */ 85 public void setId(final String id) { 86 this.id = id; 87 } 88 89 /** 90 * Gets coordinates of reconstructed 3D point. 91 * 92 * @return coordinates of reconstructed 3D point. 93 */ 94 public Point3D getPoint() { 95 return point; 96 } 97 98 /** 99 * Sets coordinates of reconstructed 3D point. 100 * 101 * @param point coordinates of reconstructed 3D point. 102 */ 103 public void setPoint(final Point3D point) { 104 this.point = point; 105 } 106 107 /** 108 * Indicates whether reconstructed point is an inlier or not. 109 * 110 * @return true if reconstructed point is an inlier, false otherwise. 111 */ 112 public boolean isInlier() { 113 return inlier; 114 } 115 116 /** 117 * Specifies whether reconstructed point is an inlier or not. 118 * 119 * @param inlier true if reconstructed point is an inlier, false otherwise. 120 */ 121 public void setInlier(final boolean inlier) { 122 this.inlier = inlier; 123 } 124 125 /** 126 * Gets quality score of sampled point. The larger the value, the better the 127 * quality. This is used for robust estimators such as PROSAC or PROMedS. 128 * This value is typically obtained from algorithms determining point 129 * correspondences. 130 * 131 * @return quality score of sampled point. 132 */ 133 public double getQualityScore() { 134 return qualityScore; 135 } 136 137 /** 138 * Sets quality score of sampled point. The larger the value, the better the 139 * quality. This is used for robust estimators such as PROSAC or PROMedS. 140 * This value is typically obtained from algorithms determining point 141 * correspondences. 142 * 143 * @param qualityScore quality score of sampled point. 144 */ 145 public void setQualityScore(final double qualityScore) { 146 this.qualityScore = qualityScore; 147 } 148 149 /** 150 * Gets covariance of reconstructed point. This is obtained from the 151 * algorithms determining points of interest or point correspondences. 152 * This might be null if covariance cannot be determined. 153 * 154 * @return covariance of reconstructed point. 155 */ 156 public Matrix getCovariance() { 157 return covariance; 158 } 159 160 /** 161 * Sets covariance of reconstructed point. This is obtained from the 162 * algorithms determining points of interest or point correspondences. 163 * 164 * @param covariance covariance of reconstructed point. 165 */ 166 public void setCovariance(final Matrix covariance) { 167 this.covariance = covariance; 168 } 169 170 /** 171 * Gets color data of reconstructed point (i.e. RGB or YUV values), if 172 * available. 173 * 174 * @return color data of reconstructed point or null. 175 */ 176 public PointColorData getColorData() { 177 return colorData; 178 } 179 180 /** 181 * Sets color data of reconstructed point (i.e. RGB or YUV values), if 182 * available. 183 * 184 * @param colorData color data of reconstructed point or null. 185 */ 186 public void setColorData(final PointColorData colorData) { 187 this.colorData = colorData; 188 } 189 }