Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
5e4ca227
Commit
5e4ca227
authored
May 11, 2011
by
Xavier Delacour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small updates to bundle adjustment implementation
parent
ad4969d8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
21 deletions
+28
-21
contrib.hpp
modules/contrib/include/opencv2/contrib/contrib.hpp
+28
-21
ba.cpp
modules/contrib/src/ba.cpp
+0
-0
No files found.
modules/contrib/include/opencv2/contrib/contrib.hpp
View file @
5e4ca227
...
...
@@ -431,8 +431,10 @@ namespace cv
DEFAULT_NUM_DISTANCE_BUCKETS
=
7
};
};
class
CV_EXPORTS
LevMarqSparse
{
typedef
bool
(
*
BundleAdjustCallback
)(
int
iteration
,
double
norm_error
,
void
*
user_data
);
class
LevMarqSparse
{
public
:
LevMarqSparse
();
LevMarqSparse
(
int
npoints
,
// number of points
...
...
@@ -453,8 +455,10 @@ namespace cv
// callback for estimation of backprojection errors
void
(
CV_CDECL
*
func
)(
int
i
,
int
j
,
Mat
&
point_params
,
Mat
&
cam_params
,
Mat
&
estim
,
void
*
data
),
void
*
data
// user-specific data passed to the callbacks
void
*
data
,
// user-specific data passed to the callbacks
BundleAdjustCallback
cb
,
void
*
user_data
);
virtual
~
LevMarqSparse
();
virtual
void
run
(
int
npoints
,
// number of points
...
...
@@ -480,24 +484,25 @@ namespace cv
virtual
void
clear
();
// useful function to do simple bundle adja
stment tasks
static
void
bundleAdjust
(
vector
<
Point3d
>&
points
,
//
positions of points in global coordinate system (input and output)
const
vector
<
vector
<
Point2d
>
>&
imagePoints
,
//
projections of 3d points for every camera
const
vector
<
vector
<
int
>
>&
visibility
,
//visibility of 3d points for every camera
vector
<
Mat
>&
cameraMatrix
,
//
intrinsic matrices of all cameras (input and output)
vector
<
Mat
>&
R
,
//
rotation matrices of all cameras (input and output)
vector
<
Mat
>&
T
,
//
translation vector of all cameras (input and output)
vector
<
Mat
>&
distCoeffs
,
//
distortion coefficients of all cameras (input and output)
// useful function to do simple bundle adju
stment tasks
static
void
bundleAdjust
(
vector
<
Point3d
>&
points
,
//
positions of points in global coordinate system (input and output)
const
vector
<
vector
<
Point2d
>
>&
imagePoints
,
//
projections of 3d points for every camera
const
vector
<
vector
<
int
>
>&
visibility
,
// visibility of 3d points for every camera
vector
<
Mat
>&
cameraMatrix
,
//
intrinsic matrices of all cameras (input and output)
vector
<
Mat
>&
R
,
//
rotation matrices of all cameras (input and output)
vector
<
Mat
>&
T
,
//
translation vector of all cameras (input and output)
vector
<
Mat
>&
distCoeffs
,
//
distortion coefficients of all cameras (input and output)
const
TermCriteria
&
criteria
=
TermCriteria
(
TermCriteria
::
COUNT
+
TermCriteria
::
EPS
,
30
,
DBL_EPSILON
));
TermCriteria
(
TermCriteria
::
COUNT
+
TermCriteria
::
EPS
,
30
,
DBL_EPSILON
),
BundleAdjustCallback
cb
=
0
,
void
*
user_data
=
0
);
protected
:
virtual
void
optimize
(
);
//main function that runs minimization
public
:
virtual
void
optimize
(
CvMat
&
_vis
);
//main function that runs minimization
//iteratively asks for measurement for visible camera-point pairs
void
ask_for_proj
(
);
void
ask_for_proj
(
CvMat
&
_vis
,
bool
once
=
false
);
//iteratively asks for Jacobians for every camera_point pair
void
ask_for_projac
(
);
void
ask_for_projac
(
CvMat
&
_vis
);
CvMat
*
err
;
//error X-hX
double
prevErrNorm
,
errNorm
;
...
...
@@ -509,9 +514,9 @@ namespace cv
CvMat
**
V
;
//size of array is equal to number of points
CvMat
**
inv_V_star
;
//inverse of V*
CvMat
*
A
;
CvMat
*
B
;
CvMat
*
W
;
CvMat
*
*
A
;
CvMat
*
*
B
;
CvMat
*
*
W
;
CvMat
*
X
;
//measurement
CvMat
*
hX
;
//current measurement extimation given new parameter vector
...
...
@@ -543,11 +548,13 @@ namespace cv
//target function and jacobian pointers, which needs to be initialized
void
(
*
fjac
)(
int
i
,
int
j
,
Mat
&
point_params
,
Mat
&
cam_params
,
Mat
&
A
,
Mat
&
B
,
void
*
data
);
void
(
*
func
)(
int
i
,
int
j
,
Mat
&
point_params
,
Mat
&
cam_params
,
Mat
&
estim
,
void
*
data
);
void
(
*
func
)(
int
i
,
int
j
,
Mat
&
point_params
,
Mat
&
cam_params
,
Mat
&
estim
,
void
*
data
);
void
*
data
;
};
BundleAdjustCallback
cb
;
void
*
user_data
;
};
CV_EXPORTS
int
chamerMatching
(
Mat
&
img
,
Mat
&
templ
,
vector
<
vector
<
Point
>
>&
results
,
vector
<
float
>&
cost
,
...
...
modules/contrib/src/ba.cpp
View file @
5e4ca227
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment