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
aa95a000
Commit
aa95a000
authored
2 years ago
by
Srinjoy4d
Browse files
Options
Downloads
Patches
Plain Diff
extract orb
parent
b1bdb632
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extract_orb.py
+39
-0
39 additions, 0 deletions
extract_orb.py
with
39 additions
and
0 deletions
extract_orb.py
+
39
−
0
View file @
aa95a000
import
argparse
import
numpy
as
np
import
cv2
import
h5py
import
os
from
utilities
import
*
parser
=
argparse
.
ArgumentParser
(
description
=
'
Feature extractor SIFT
'
)
parser
.
add_argument
(
'
--path
'
,
default
=
'
./dataset
'
,
type
=
str
)
arg
=
parser
.
parse_args
()
print
(
arg
)
orb
=
cv2
.
ORB_create
()
kp_dict
=
{}
desc_dict
=
{}
for
image_name
in
os
.
listdir
(
arg
.
path
):
im
=
cv2
.
imread
(
arg
.
path
+
image_name
)
gray
=
cv2
.
cvtColor
(
im
,
cv2
.
COLOR_BGR2GRAY
)
kp
,
descriptors
=
orb
.
detectAndCompute
(
gray
,
None
)
#print(kp)
#print(descriptors)
keypoints
=
np
.
array
([
k
.
pt
for
k
in
kp
])
kp_dict
[
image_name
]
=
keypoints
desc_dict
[
image_name
]
=
descriptors
save_h5
(
kp_dict
,
'
keypoints_orb.h5
'
)
save_h5
(
desc_dict
,
'
descriptors_orb.h5
'
)
k2
=
load_h5
(
'
keypoints_orb.h5
'
)
d2
=
load_h5
(
"
descriptors_orb.h5
"
)
keypoints
=
k2
descriptors
=
d2
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