AliceVision
Photogrammetric Computer Vision Framework
structures.hpp
1 // This file is part of the AliceVision project.
2 // Copyright (c) 2017 AliceVision contributors.
3 // This Source Code Form is subject to the terms of the Mozilla Public License,
4 // v. 2.0. If a copy of the MPL was not distributed with this file,
5 // You can obtain one at https://mozilla.org/MPL/2.0/.
6 
7 #pragma once
8 
9 #include <aliceVision/mvsData/Point2d.hpp>
10 #include <aliceVision/mvsData/Point3d.hpp>
11 #include <aliceVision/mvsData/Matrix3x3.hpp>
12 #include <aliceVision/mvsData/Matrix3x4.hpp>
13 #include <aliceVision/mvsData/StaticVector.hpp>
14 
15 namespace aliceVision {
16 
17 struct Voxel;
18 
19 // TODO: Remove and replace with <aliceVision/types.hpp>
20 typedef uint32_t IndexT;
21 
23 {
24  IndexT viewId;
25  int width;
26  int height;
27  int size;
28  std::string path;
29 
30  ImageParams(IndexT _viewId, int _width, int _height, const std::string& _path)
31  : viewId(_viewId),
32  width(_width),
33  height(_height),
34  size(_width * _height),
35  path(_path)
36  {}
37 
38  ImageParams& operator=(const ImageParams& param)
39  {
40  viewId = param.viewId;
41  width = param.width;
42  height = param.height;
43  size = param.size;
44  return *this;
45  }
46 };
47 
48 struct SortedId
49 {
50  int id;
51  float value;
52 
53  SortedId() {}
54 
55  SortedId(int _id, float _value)
56  {
57  id = _id;
58  value = _value;
59  }
60 
61  SortedId& operator=(const SortedId& param)
62  {
63  id = param.id;
64  value = param.value;
65  return *this;
66  }
67 
68  inline bool operator>(const SortedId& param) const { return (value > param.value); }
69 
70  inline bool operator<(const SortedId& param) const { return (value < param.value); }
71 };
72 
73 int qSortCompareFloatAsc(const void* ia, const void* ib);
74 int qSortCompareIntAsc(const void* ia, const void* ib);
75 int qsortCompareSortedIdDesc(const void* ia, const void* ib);
76 int qsortCompareSortedIdAsc(const void* ia, const void* ib);
77 int qSortCompareVoxelByXAsc(const void* ia, const void* ib);
78 int qSortCompareVoxelByYAsc(const void* ia, const void* ib);
79 int qSortCompareVoxelByZAsc(const void* ia, const void* ib);
80 int qSortComparePixelByXDesc(const void* ia, const void* ib);
81 int qSortComparePixelByXAsc(const void* ia, const void* ib);
82 
83 struct IdValue
84 {
85  int id;
86  float value;
87 
88  IdValue() {}
89 
90  IdValue(int _id, float _value)
91  {
92  id = _id;
93  value = _value;
94  }
95 
96  IdValue& operator=(const IdValue& param)
97  {
98  id = param.id;
99  value = param.value;
100  return *this;
101  }
102 
103  inline bool operator>(const IdValue& param) const { return (value > param.value); }
104 
105  inline bool operator<(const IdValue& param) const { return (value < param.value); }
106 };
107 
109 {
110  int cam;
111  Point2d pts[3];
112 
113  mv2DTriangle& operator=(const mv2DTriangle& m)
114  {
115  pts[0] = m.pts[0];
116  pts[1] = m.pts[1];
117  pts[2] = m.pts[2];
118  cam = m.cam;
119  return *this;
120  }
121 };
122 
124 {
125  Matrix3x4 P;
126  Matrix3x3 R, K, iR, iK, iCam;
127  Point3d C;
128  float f, k1, k2;
129 };
130 
131 int indexOfSortedVoxelArrByX(int val, StaticVector<Voxel>& values, int startId, int stopId);
132 
133 } // namespace aliceVision
aliceVision::Point3d
Definition: Point3d.hpp:24
aliceVision::Matrix3x4
Definition: Matrix3x4.hpp:16
aliceVision::mv2DTriangle
Definition: structures.hpp:108
aliceVision::CameraMatrices
Definition: structures.hpp:123
aliceVision
Definition: checkerDetector.cpp:32
aliceVision::SortedId
Definition: structures.hpp:48
aliceVision::IdValue
Definition: structures.hpp:83
aliceVision::Point2d
Definition: Point2d.hpp:14
aliceVision::ImageParams
Definition: structures.hpp:22
aliceVision::Matrix3x3
Definition: Matrix3x3.hpp:18
aliceVision::StaticVector
Definition: StaticVector.hpp:24