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
3928dd9d
Commit
3928dd9d
authored
May 06, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added --ba_thresh key into opencv_stitching CLI
parent
e72c0ad6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
5 deletions
+23
-5
main.cpp
modules/stitching/main.cpp
+9
-2
motion_estimators.cpp
modules/stitching/motion_estimators.cpp
+11
-2
motion_estimators.hpp
modules/stitching/motion_estimators.hpp
+3
-1
No files found.
modules/stitching/main.cpp
View file @
3928dd9d
...
@@ -15,6 +15,7 @@ void printUsage()
...
@@ -15,6 +15,7 @@ void printUsage()
<<
"Usage: opencv_stitching img1 img2 [...imgN]
\n
"
<<
"Usage: opencv_stitching img1 img2 [...imgN]
\n
"
<<
"
\t
[--matchconf <0.0-1.0>]
\n
"
<<
"
\t
[--matchconf <0.0-1.0>]
\n
"
<<
"
\t
[--ba (ray|focal_ray)]
\n
"
<<
"
\t
[--ba (ray|focal_ray)]
\n
"
<<
"
\t
[--ba_thresh <float>]
\n
"
//<< "\t[--wavecorrect (no|yes)]\n"
//<< "\t[--wavecorrect (no|yes)]\n"
<<
"
\t
[--warp (plane|cylindrical|spherical)]
\n
"
<<
"
\t
[--warp (plane|cylindrical|spherical)]
\n
"
<<
"
\t
[--seam (no|voronoi|graphcut)]
\n
"
<<
"
\t
[--seam (no|voronoi|graphcut)]
\n
"
...
@@ -29,6 +30,7 @@ int main(int argc, char* argv[])
...
@@ -29,6 +30,7 @@ int main(int argc, char* argv[])
vector
<
Mat
>
images
;
vector
<
Mat
>
images
;
string
result_name
=
"result.png"
;
string
result_name
=
"result.png"
;
int
ba_space
=
BundleAdjuster
::
RAY_SPACE
;
int
ba_space
=
BundleAdjuster
::
RAY_SPACE
;
float
ba_thresh
=
1.
f
;
bool
wave_correct
=
false
;
bool
wave_correct
=
false
;
int
warp_type
=
Warper
::
SPHERICAL
;
int
warp_type
=
Warper
::
SPHERICAL
;
bool
user_match_conf
=
false
;
bool
user_match_conf
=
false
;
...
@@ -52,7 +54,7 @@ int main(int argc, char* argv[])
...
@@ -52,7 +54,7 @@ int main(int argc, char* argv[])
else
if
(
string
(
argv
[
i
])
==
"--matchconf"
)
else
if
(
string
(
argv
[
i
])
==
"--matchconf"
)
{
{
user_match_conf
=
true
;
user_match_conf
=
true
;
match_conf
=
static_cast
<
float
>
(
atof
(
string
(
argv
[
i
+
1
]).
c_str
()
));
match_conf
=
static_cast
<
float
>
(
atof
(
argv
[
i
+
1
]
));
i
++
;
i
++
;
}
}
else
if
(
string
(
argv
[
i
])
==
"--ba"
)
else
if
(
string
(
argv
[
i
])
==
"--ba"
)
...
@@ -68,6 +70,11 @@ int main(int argc, char* argv[])
...
@@ -68,6 +70,11 @@ int main(int argc, char* argv[])
}
}
i
++
;
i
++
;
}
}
else
if
(
string
(
argv
[
i
])
==
"--ba_thresh"
)
{
ba_thresh
=
static_cast
<
float
>
(
atof
(
argv
[
i
+
1
]));
i
++
;
}
//else if (string(argv[i]) == "--wavecorrect")
//else if (string(argv[i]) == "--wavecorrect")
//{
//{
// if (string(argv[i + 1]) == "no")
// if (string(argv[i + 1]) == "no")
...
@@ -176,7 +183,7 @@ int main(int argc, char* argv[])
...
@@ -176,7 +183,7 @@ int main(int argc, char* argv[])
}
}
LOGLN
(
"Bundle adjustment..."
);
LOGLN
(
"Bundle adjustment..."
);
BundleAdjuster
adjuster
(
ba_space
);
BundleAdjuster
adjuster
(
ba_space
,
ba_thresh
);
adjuster
(
images
,
features
,
pairwise_matches
,
cameras
);
adjuster
(
images
,
features
,
pairwise_matches
,
cameras
);
if
(
wave_correct
)
if
(
wave_correct
)
...
...
modules/stitching/motion_estimators.cpp
View file @
3928dd9d
...
@@ -491,8 +491,17 @@ void BundleAdjuster::estimate(const vector<Mat> &images, const vector<ImageFeatu
...
@@ -491,8 +491,17 @@ void BundleAdjuster::estimate(const vector<Mat> &images, const vector<ImageFeatu
edges_
.
clear
();
edges_
.
clear
();
for
(
int
i
=
0
;
i
<
num_images_
-
1
;
++
i
)
for
(
int
i
=
0
;
i
<
num_images_
-
1
;
++
i
)
{
for
(
int
j
=
i
+
1
;
j
<
num_images_
;
++
j
)
for
(
int
j
=
i
+
1
;
j
<
num_images_
;
++
j
)
edges_
.
push_back
(
make_pair
(
i
,
j
));
{
int
pair_idx
=
i
*
num_images_
+
j
;
const
MatchesInfo
&
mi
=
pairwise_matches_
[
pair_idx
];
float
ni
=
static_cast
<
float
>
(
mi
.
num_inliers
);
float
nf
=
static_cast
<
float
>
(
mi
.
matches
.
size
());
if
(
ni
/
(
8.
f
+
0.3
f
*
nf
)
>
dist_thresh_
)
edges_
.
push_back
(
make_pair
(
i
,
j
));
}
}
total_num_matches_
=
0
;
total_num_matches_
=
0
;
for
(
size_t
i
=
0
;
i
<
edges_
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
edges_
.
size
();
++
i
)
...
@@ -528,7 +537,7 @@ void BundleAdjuster::estimate(const vector<Mat> &images, const vector<ImageFeatu
...
@@ -528,7 +537,7 @@ void BundleAdjuster::estimate(const vector<Mat> &images, const vector<ImageFeatu
if
(
_err
)
if
(
_err
)
{
{
calcError
(
err_
);
calcError
(
err_
);
//
LOGLN("Error: " << sqrt(err_.dot(err_)));
LOGLN
(
"Error: "
<<
sqrt
(
err_
.
dot
(
err_
)));
count
++
;
count
++
;
CvMat
matErr
=
err_
;
CvMat
matErr
=
err_
;
cvCopy
(
&
matErr
,
_err
);
cvCopy
(
&
matErr
,
_err
);
...
...
modules/stitching/motion_estimators.hpp
View file @
3928dd9d
...
@@ -125,7 +125,8 @@ class BundleAdjuster : public Estimator
...
@@ -125,7 +125,8 @@ class BundleAdjuster : public Estimator
public
:
public
:
enum
{
RAY_SPACE
,
FOCAL_RAY_SPACE
};
enum
{
RAY_SPACE
,
FOCAL_RAY_SPACE
};
BundleAdjuster
(
int
cost_space
=
FOCAL_RAY_SPACE
)
:
cost_space_
(
cost_space
)
{}
BundleAdjuster
(
int
cost_space
=
FOCAL_RAY_SPACE
,
float
dist_thresh
=
1.
f
)
:
cost_space_
(
cost_space
),
dist_thresh_
(
dist_thresh
)
{}
private
:
private
:
void
estimate
(
const
std
::
vector
<
cv
::
Mat
>
&
images
,
const
std
::
vector
<
ImageFeatures
>
&
features
,
void
estimate
(
const
std
::
vector
<
cv
::
Mat
>
&
images
,
const
std
::
vector
<
ImageFeatures
>
&
features
,
...
@@ -143,6 +144,7 @@ private:
...
@@ -143,6 +144,7 @@ private:
std
::
vector
<
std
::
pair
<
int
,
int
>
>
edges_
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>
edges_
;
int
cost_space_
;
int
cost_space_
;
float
dist_thresh_
;
cv
::
Mat
err_
,
err1_
,
err2_
;
cv
::
Mat
err_
,
err1_
,
err2_
;
cv
::
Mat
J_
;
cv
::
Mat
J_
;
};
};
...
...
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