View Javadoc
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  package com.irurueta.ar.sfm;
17  
18  import com.irurueta.algebra.Matrix;
19  import com.irurueta.geometry.PinholeCamera;
20  
21  import java.io.Serializable;
22  
23  /**
24   * Contains data of estimated camera.
25   */
26  public class EstimatedCamera implements Serializable {
27  
28      /**
29       * Default quality score value.
30       */
31      public static final double DEFAULT_QUALITY_SCORE = 1.0;
32  
33      /**
34       * ID to identify this instance. This is useful in case that this data is
35       * stored in some sort of database and must be set externally.
36       */
37      private String id;
38  
39      /**
40       * ID of view for which camera has been estimated.
41       */
42      private int viewId;
43  
44      /**
45       * Estimated camera.
46       */
47      private PinholeCamera camera;
48  
49      /**
50       * Quality score of estimated camera. The larger the value, the better the
51       * quality. This is used for robust estimators such as PROSAC or PROMedS.
52       * This value is typically obtained during camera estimation.
53       */
54      private double qualityScore = DEFAULT_QUALITY_SCORE;
55  
56      /**
57       * Covariance of estimated camera. This can be computed during camera
58       * estimation.
59       */
60      private Matrix covariance;
61  
62      /**
63       * Gets id to identify this instance. This is useful in case that this data
64       * is stored in some sort of database and must be set externally.
65       *
66       * @return id to identify this instance.
67       */
68      public String getId() {
69          return id;
70      }
71  
72      /**
73       * Sets id to identify this instance. This is useful in case that this data
74       * is stored in some sort of database and must be set externally.
75       *
76       * @param id id to identify this instance.
77       */
78      public void setId(final String id) {
79          this.id = id;
80      }
81  
82      /**
83       * Gets id of view for which camera has been estimated.
84       *
85       * @return id of view for which camera has been estimated.
86       */
87      public int getViewId() {
88          return viewId;
89      }
90  
91      /**
92       * Sets id of view for which camera has been estimated.
93       *
94       * @param viewId id of view for which camera has been estimated.
95       */
96      public void setViewId(final int viewId) {
97          this.viewId = viewId;
98      }
99  
100     /**
101      * Gets estimated camera.
102      *
103      * @return estimated camera.
104      */
105     public PinholeCamera getCamera() {
106         return camera;
107     }
108 
109     /**
110      * Sets estimated camera.
111      *
112      * @param camera estimated camera.
113      */
114     public void setCamera(final PinholeCamera camera) {
115         this.camera = camera;
116     }
117 
118     /**
119      * Gets quality score of estimated camera. The larger the value, the better
120      * the quality. This is used for robust estimators such as PROSAC or
121      * PROMedS.
122      * This value is typically obtained from algorithms determining point
123      * correspondences.
124      *
125      * @return quality score of estimated camera.
126      */
127     public double getQualityScore() {
128         return qualityScore;
129     }
130 
131     /**
132      * Sets quality score of estimated camera. The larger the value, the better
133      * the quality. This is used for robust estimators such as PROSAC or
134      * PROMedS.
135      * This value is typically obtained from algorithms determining point
136      * correspondences.
137      *
138      * @param qualityScore quality score of estimated camera.
139      */
140     public void setQualityScore(final double qualityScore) {
141         this.qualityScore = qualityScore;
142     }
143 
144     /**
145      * Gets covariance of estimated camera. This can be computed during camera
146      * estimation.
147      *
148      * @return covariance of estimated camera.
149      */
150     public Matrix getCovariance() {
151         return covariance;
152     }
153 
154     /**
155      * Sets covariance of estimated camera. This can be computed during camera
156      * estimation.
157      *
158      * @param covariance covariance of estimated camera.
159      */
160     public void setCovariance(final Matrix covariance) {
161         this.covariance = covariance;
162     }
163 }