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
Merge requests
!52
Resolve "Document algorithm functions and classes"
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Resolve "Document algorithm functions and classes"
49-document-algorithm-functions-and-classes
into
master
Overview
0
Commits
2
Pipelines
0
Changes
11
Merged
Anders Langlie
requested to merge
49-document-algorithm-functions-and-classes
into
master
4 years ago
Overview
0
Commits
2
Pipelines
0
Changes
11
Closes
#49 (closed)
Edited
4 years ago
by
Anders Langlie
0
0
Merge request reports
Compare
master
version 1
bbddb10f
4 years ago
master (base)
and
latest version
latest version
1de877ed
2 commits,
4 years ago
version 1
bbddb10f
1 commit,
4 years ago
11 files
+
98
−
131
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
11
algorithm/SalamanderImage.py
+
25
−
5
View file @ 1de877ed
Edit in single-file editor
Open in Web IDE
class
SalamanderImage
():
descriptors
=
[]
filename
=
''
from
cv2
import
cv2
import
numpy
as
np
import
algorithm.dsift
as
dsift
def
__init__
(
self
,
filename
):
self
.
filename
class
SalamanderImage
:
descriptors
=
[]
filename
=
''
def
__init__
(
self
,
filename
):
self
.
filename
=
filename
self
.
descriptors
=
self
.
calculate_descriptors
()
def
calculate_descriptors
(
self
):
"""
Calculates the descriptors of the member image
Returns: The calculated descriptors
"""
image
=
cv2
.
imdecode
(
np
.
fromfile
(
self
.
filename
,
dtype
=
np
.
uint8
),
cv2
.
IMREAD_GRAYSCALE
)
if
image
is
None
:
raise
FileNotFoundError
(
"
Cannot find image file
"
+
self
.
filename
)
return
dsift
.
compute_descriptors
(
image
)
Loading