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  
17  package com.irurueta.ar.sfm;
18  
19  import java.io.Serializable;
20  
21  /**
22   * Contains configuration for a multiple view sparse re-constructor assuming that the
23   * initial baseline (separation between initial cameras) is known.
24   */
25  public class KnownBaselineSparseReconstructorConfiguration extends
26          BaseSparseReconstructorConfiguration<KnownBaselineSparseReconstructorConfiguration> implements Serializable {
27  
28      /**
29       * Default camera baseline (expressed in a unit of distance such as meters).
30       * Methods such as DIAC or Essential assume that the camera baseline is 1.0,
31       * which yields a reconstruction up to scale, unless the real baseline is provided.
32       */
33      public static final double DEFAULT_BASELINE = 1.0;
34  
35      /**
36       * Camera baseline (expressed in a unit of distance such as meters).
37       * Contains the real separation between camera centers so that the real scale of
38       * cameras and reconstructed points can be retrieved.
39       */
40      private double baseline = DEFAULT_BASELINE;
41  
42      /**
43       * Creates an instance of a multiple view sparse re-constructor configuration with
44       * known camera baseline.
45       *
46       * @return configuration instance.
47       */
48      public static KnownBaselineSparseReconstructorConfiguration make() {
49          return new KnownBaselineSparseReconstructorConfiguration();
50      }
51  
52      /**
53       * Gets camera baseline (expressed in a unit of distance such as meters).
54       * Contains the real separation between camera centers so that the real scale of
55       * cameras and reconstructed points can be retrieved.
56       *
57       * @return camera baseline.
58       */
59      public double getBaseline() {
60          return baseline;
61      }
62  
63      /**
64       * Sets camera baseline (expressed in a unit of distance such as meters).
65       * Contains the real separation between camera centers so that the real scale
66       * of cameras and reconstructed points can be retrieved.
67       *
68       * @param baseline camera baseline.
69       * @return this instance so that methods can be easily chained.
70       */
71      public KnownBaselineSparseReconstructorConfiguration setBaseline(final double baseline) {
72          this.baseline = baseline;
73          return this;
74      }
75  }