Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feature_extractors
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ckyao2
feature_extractors
Commits
517a6ba1
Commit
517a6ba1
authored
2 years ago
by
rcam2
Browse files
Options
Downloads
Patches
Plain Diff
matcher
parent
aa95a000
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
feature_matcher.py
+40
-0
40 additions, 0 deletions
feature_matcher.py
with
40 additions
and
0 deletions
feature_matcher.py
0 → 100644
+
40
−
0
View file @
517a6ba1
import
argparse
import
numpy
as
np
import
cv2
import
h5py
import
os
def
save_h5
(
dict_to_save
,
filename
):
with
h5py
.
File
(
filename
,
'
w
'
)
as
f
:
for
key
in
dict_to_save
:
f
.
create_dataset
(
key
,
data
=
dict_to_save
[
key
])
def
load_h5
(
filename
):
dict
=
{}
with
h5py
.
File
(
filename
,
'
r
'
)
as
f
:
keys
=
[
key
for
key
in
f
.
keys
()]
for
key
in
keys
:
dict
[
key
]
=
f
[
key
][()]
def
compute_matches
(
desc1
,
desc2
,
kps1
=
None
,
kps2
=
None
):
bf
=
cv2
.
BFMatcher
(
cv2
.
NORM_L2
,
crossCheck
=
True
)
matches
=
bf
.
match
(
desc1
,
desc2
)
return
matches
if
__name__
==
'
__main__
'
parser
=
argparse
.
ArgumentParser
(
description
=
'
Feature extractor SIFT
'
)
#parser.add_argument('--path', default='./dataset', type=str)
parser
.
add_argument
(
'
--desc
'
,
type
=
str
)
arg
=
parser
.
parse_args
()
print
(
arg
)
descriptors
=
load_h5
(
desc
)
for
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment