Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pipeline.h « simple_pipeline « libmv « libmv « extern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8489012b958c4c8c124d0e0638dbcc1c9b82003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright (c) 2011 libmv authors.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.

#ifndef LIBMV_SIMPLE_PIPELINE_PIPELINE_H_
#define LIBMV_SIMPLE_PIPELINE_PIPELINE_H_

#include "libmv/simple_pipeline/callbacks.h"
#include "libmv/simple_pipeline/tracks.h"
#include "libmv/simple_pipeline/reconstruction.h"

namespace libmv {

/*!
    Estimate camera poses and scene 3D coordinates for all frames and tracks.

    This method should be used once there is an initial reconstruction in
    place, for example by reconstructing from two frames that have a sufficient
    baseline and number of tracks in common. This function iteratively
    triangulates points that are visible by cameras that have their pose
    estimated, then resections (i.e. estimates the pose) of cameras that are
    not estimated yet that can see triangulated points. This process is
    repeated until all points and cameras are estimated. Periodically, bundle
    adjustment is run to ensure a quality reconstruction.

    \a options are used to define some specific befaviours based on settings
    see documentation for ReconstructionOptions

    \a tracks should contain markers used in the reconstruction.
    \a reconstruction should contain at least some 3D points or some estimated
    cameras. The minimum number of cameras is two (with no 3D points) and the
    minimum number of 3D points (with no estimated cameras) is 5.

    \sa EuclideanResect, EuclideanIntersect, EuclideanBundle
*/
void EuclideanCompleteReconstruction(
        const ReconstructionOptions &options,
        const Tracks &tracks,
        EuclideanReconstruction *reconstruction,
        ProgressUpdateCallback *update_callback = NULL);

/*!
    Estimate camera matrices and homogeneous 3D coordinates for all frames and
    tracks.

    This method should be used once there is an initial reconstruction in
    place, for example by reconstructing from two frames that have a sufficient
    baseline and number of tracks in common. This function iteratively
    triangulates points that are visible by cameras that have their pose
    estimated, then resections (i.e. estimates the pose) of cameras that are
    not estimated yet that can see triangulated points. This process is
    repeated until all points and cameras are estimated. Periodically, bundle
    adjustment is run to ensure a quality reconstruction.

    \a options are used to define some specific befaviours based on settings
    see documentation for ReconstructionOptions

    \a tracks should contain markers used in the reconstruction.
    \a reconstruction should contain at least some 3D points or some estimated
    cameras. The minimum number of cameras is two (with no 3D points) and the
    minimum number of 3D points (with no estimated cameras) is 5.

    \sa ProjectiveResect, ProjectiveIntersect, ProjectiveBundle
*/
void ProjectiveCompleteReconstruction(const ReconstructionOptions &options,
                                      const Tracks &tracks,
                                      ProjectiveReconstruction *reconstruction);


class CameraIntrinsics;

// TODO(keir): Decide if we want these in the public API, and if so, what the
// appropriate include file is.

double EuclideanReprojectionError(const Tracks &image_tracks,
                                  const EuclideanReconstruction &reconstruction,
                                  const CameraIntrinsics &intrinsics);

double ProjectiveReprojectionError(
    const Tracks &image_tracks,
    const ProjectiveReconstruction &reconstruction,
    const CameraIntrinsics &intrinsics);

void InvertIntrinsicsForTracks(const Tracks &raw_tracks,
                               const CameraIntrinsics &camera_intrinsics,
                               Tracks *calibrated_tracks);

}  // namespace libmv

#endif  // LIBMV_SIMPLE_PIPELINE_PIPELINE_H_