Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Salamander - API
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Herman Andersen Dyrkorn
Salamander - API
Commits
4e85fd35
Commit
4e85fd35
authored
4 years ago
by
Anders Langlie
Browse files
Options
Downloads
Plain Diff
Merge branch '44-make-matching-more-efficient' into 'master'
Resolve "Make matching more efficient" Closes
#44
See merge request
!47
parents
4a65aeb2
58a802d3
Branches
Branches containing commit
No related tags found
1 merge request
!47
Resolve "Make matching more efficient"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
algorithm/brute_force_matching.py
+7
-6
7 additions, 6 deletions
algorithm/brute_force_matching.py
algorithm/imageprocessing.py
+1
-1
1 addition, 1 deletion
algorithm/imageprocessing.py
with
8 additions
and
7 deletions
algorithm/brute_force_matching.py
+
7
−
6
View file @
4e85fd35
...
@@ -5,12 +5,10 @@ import glob
...
@@ -5,12 +5,10 @@ import glob
min_good_match
=
15
min_good_match
=
15
match_dist
=
0.75
match_dist
=
0.75
def
match_single_image
(
input_image
,
match_image
):
bf
=
cv2
.
BFMatcher
()
input_salamander
=
create_salamander_image
(
input_image
)
match_salamander
=
create_salamander_image
(
match_image
)
match
=
bf
.
knnMatch
(
input_salamander
.
descriptors
,
match_salamander
.
descriptors
,
k
=
2
)
def
match_single_image
(
input_salamander
,
match_salamander
):
match
=
cv2
.
BFMatcher
().
knnMatch
(
input_salamander
.
descriptors
,
match_salamander
.
descriptors
,
k
=
2
)
goodmatch
=
[]
goodmatch
=
[]
for
m
,
n
in
match
:
for
m
,
n
in
match
:
...
@@ -20,15 +18,18 @@ def match_single_image(input_image, match_image):
...
@@ -20,15 +18,18 @@ def match_single_image(input_image, match_image):
return
True
,
len
(
goodmatch
)
return
True
,
len
(
goodmatch
)
return
False
,
0
return
False
,
0
def
match_file_structure
(
input_image
:
str
,
match_directory
:
str
):
def
match_file_structure
(
input_image
:
str
,
match_directory
:
str
):
best_match
=
-
1
best_match
=
-
1
match_count
=
0
match_count
=
0
# check if input path is valid:
if
os
.
path
.
isfile
(
input_image
):
if
os
.
path
.
isfile
(
input_image
):
input_salamander
=
create_salamander_image
(
input_image
)
for
folder
in
os
.
listdir
(
match_directory
):
for
folder
in
os
.
listdir
(
match_directory
):
name_list
=
glob
.
glob
(
os
.
path
.
join
(
match_directory
,
folder
,
"
*_str.*
"
))
name_list
=
glob
.
glob
(
os
.
path
.
join
(
match_directory
,
folder
,
"
*_str.*
"
))
for
filename
in
name_list
:
for
filename
in
name_list
:
res
,
num_matches
=
match_single_image
(
input_
image
,
filename
)
res
,
num_matches
=
match_single_image
(
input_
salamander
,
create_salamander_image
(
filename
)
)
if
res
and
num_matches
>
match_count
:
if
res
and
num_matches
>
match_count
:
match_count
=
num_matches
match_count
=
num_matches
best_match
=
int
(
folder
)
best_match
=
int
(
folder
)
...
...
This diff is collapsed.
Click to expand it.
algorithm/imageprocessing.py
+
1
−
1
View file @
4e85fd35
...
@@ -9,7 +9,7 @@ import algorithm.dsift as dsift
...
@@ -9,7 +9,7 @@ import algorithm.dsift as dsift
import
algorithm.segmentation
as
segmentation
import
algorithm.segmentation
as
segmentation
def
create_salamander_image
(
filename
:
str
):
def
create_salamander_image
(
filename
:
str
):
print
(
"
Processing image
"
+
filename
)
#
print("Processing image " + filename)
salamander_image
=
SalamanderImage
(
filename
)
salamander_image
=
SalamanderImage
(
filename
)
salamander_image
.
filename
=
filename
salamander_image
.
filename
=
filename
...
...
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