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
c92b040c
Commit
c92b040c
authored
Aug 15, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated saving matches graph in opencv_stitching
parent
8b7d74e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
34 deletions
+36
-34
motion_estimators.cpp
modules/stitching/motion_estimators.cpp
+36
-34
No files found.
modules/stitching/motion_estimators.cpp
View file @
c92b040c
...
@@ -414,57 +414,59 @@ string matchesGraphAsString(vector<string> &pathes, vector<MatchesInfo> &pairwis
...
@@ -414,57 +414,59 @@ string matchesGraphAsString(vector<string> &pathes, vector<MatchesInfo> &pairwis
stringstream
str
;
stringstream
str
;
str
<<
"graph matches_graph{
\n
"
;
str
<<
"graph matches_graph{
\n
"
;
set
<
int
>
added_imgs
;
const
int
num_images
=
static_cast
<
int
>
(
pathes
.
size
());
set
<
pair
<
int
,
int
>
>
span_tree_edges
;
DjSets
comps
(
num_images
);
// Add matches
for
(
int
i
=
0
;
i
<
num_images
;
++
i
)
for
(
size_t
i
=
0
;
i
<
pairwise_matches
.
size
();
++
i
)
{
{
if
(
pairwise_matches
[
i
].
src_img_idx
<
pairwise_matches
[
i
].
dst_img_idx
&&
for
(
int
j
=
0
;
j
<
num_images
;
++
j
)
pairwise_matches
[
i
].
confidence
>
conf_threshold
)
{
{
string
name_src
=
pathes
[
pairwise_matches
[
i
].
src_img_idx
];
if
(
pairwise_matches
[
i
*
num_images
+
j
].
confidence
<
conf_threshold
)
continue
;
int
comp1
=
comps
.
find
(
i
);
int
comp2
=
comps
.
find
(
j
);
if
(
comp1
!=
comp2
)
{
comps
.
merge
(
comp1
,
comp2
);
span_tree_edges
.
insert
(
make_pair
(
i
,
j
));
}
}
}
for
(
set
<
pair
<
int
,
int
>
>::
const_iterator
itr
=
span_tree_edges
.
begin
();
itr
!=
span_tree_edges
.
end
();
++
itr
)
{
pair
<
int
,
int
>
edge
=
*
itr
;
if
(
span_tree_edges
.
find
(
edge
)
!=
span_tree_edges
.
end
())
{
string
name_src
=
pathes
[
edge
.
first
];
size_t
prefix_len
=
name_src
.
find_last_of
(
"/
\\
"
);
size_t
prefix_len
=
name_src
.
find_last_of
(
"/
\\
"
);
if
(
prefix_len
!=
string
::
npos
)
prefix_len
++
;
else
prefix_len
=
0
;
if
(
prefix_len
!=
string
::
npos
)
prefix_len
++
;
else
prefix_len
=
0
;
name_src
=
name_src
.
substr
(
prefix_len
,
name_src
.
size
()
-
prefix_len
);
name_src
=
name_src
.
substr
(
prefix_len
,
name_src
.
size
()
-
prefix_len
);
string
name_dst
=
pathes
[
pairwise_matches
[
i
].
dst_img_idx
];
string
name_dst
=
pathes
[
edge
.
second
];
prefix_len
=
name_dst
.
find_last_of
(
"/
\\
"
);
prefix_len
=
name_dst
.
find_last_of
(
"/
\\
"
);
if
(
prefix_len
!=
string
::
npos
)
prefix_len
++
;
else
prefix_len
=
0
;
if
(
prefix_len
!=
string
::
npos
)
prefix_len
++
;
else
prefix_len
=
0
;
name_dst
=
name_dst
.
substr
(
prefix_len
,
name_dst
.
size
()
-
prefix_len
);
name_dst
=
name_dst
.
substr
(
prefix_len
,
name_dst
.
size
()
-
prefix_len
);
added_imgs
.
insert
(
pairwise_matches
[
i
].
src_img_idx
);
int
pos
=
edge
.
first
*
num_images
+
edge
.
second
;
added_imgs
.
insert
(
pairwise_matches
[
i
].
dst_img_idx
);
str
<<
"
\"
"
<<
name_src
<<
"
\"
--
\"
"
<<
name_dst
<<
"
\"
"
str
<<
"
\"
"
<<
name_src
<<
"
\"
--
\"
"
<<
name_dst
<<
"
\"
"
<<
"[label=
\"
Nm="
<<
pairwise_matches
[
i
].
matches
.
size
()
<<
"[label=
\"
Nm="
<<
pairwise_matches
[
pos
].
matches
.
size
()
<<
", Ni="
<<
pairwise_matches
[
i
].
num_inliers
<<
", Ni="
<<
pairwise_matches
[
pos
].
num_inliers
<<
", C="
<<
pairwise_matches
[
i
].
confidence
<<
"
\"
];
\n
"
;
<<
", C="
<<
pairwise_matches
[
pos
].
confidence
<<
"
\"
];
\n
"
;
}
}
}
}
// Add unmatched images
for
(
size_t
i
=
0
;
i
<
comps
.
size
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
pairwise_matches
.
size
();
++
i
)
{
{
if
(
pairwise_matches
[
i
].
src_img_idx
<
pairwise_matches
[
i
].
dst_img_idx
)
if
(
comps
.
size
[
comps
.
find
(
i
)]
==
1
)
{
{
if
(
added_imgs
.
find
(
pairwise_matches
[
i
].
src_img_idx
)
==
added_imgs
.
end
())
string
name
=
pathes
[
i
];
{
size_t
prefix_len
=
name
.
find_last_of
(
"/
\\
"
);
added_imgs
.
insert
(
pairwise_matches
[
i
].
src_img_idx
);
if
(
prefix_len
!=
string
::
npos
)
prefix_len
++
;
else
prefix_len
=
0
;
string
name
=
pathes
[
pairwise_matches
[
i
].
src_img_idx
];
name
=
name
.
substr
(
prefix_len
,
name
.
size
()
-
prefix_len
);
size_t
prefix_len
=
name
.
find_last_of
(
"/
\\
"
);
str
<<
"
\"
"
<<
name
<<
"
\"
;
\n
"
;
if
(
prefix_len
!=
string
::
npos
)
prefix_len
++
;
else
prefix_len
=
0
;
name
=
name
.
substr
(
prefix_len
,
name
.
size
()
-
prefix_len
);
str
<<
"
\"
"
<<
name
<<
"
\"
;
\n
"
;
}
if
(
added_imgs
.
find
(
pairwise_matches
[
i
].
dst_img_idx
)
==
added_imgs
.
end
())
{
added_imgs
.
insert
(
pairwise_matches
[
i
].
dst_img_idx
);
string
name
=
pathes
[
pairwise_matches
[
i
].
dst_img_idx
];
size_t
prefix_len
=
name
.
find_last_of
(
"/
\\
"
);
if
(
prefix_len
!=
string
::
npos
)
prefix_len
++
;
else
prefix_len
=
0
;
name
=
name
.
substr
(
prefix_len
,
name
.
size
()
-
prefix_len
);
str
<<
"
\"
"
<<
name
<<
"
\"
;
\n
"
;
}
}
}
}
}
...
...
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