Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-157
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-157
2021-157
Commits
dc38367d
Commit
dc38367d
authored
Nov 26, 2021
by
Faseel Nazeel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
7bddb8aa
Pipeline
#4223
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
harris.py
harris.py
+26
-0
No files found.
harris.py
0 → 100644
View file @
dc38367d
import
cv2
import
numpy
as
np
from
.helpers
import
corners_to_keypoints
class
HARRIS
:
def
__init__
(
self
,
blockSize
=
2
,
apertureSize
=
3
,
k
=
0.1
,
T
=
0.02
):
self
.
blockSize
=
blockSize
self
.
apertureSize
=
apertureSize
self
.
k
=
k
self
.
T
=
T
def
detect
(
self
,
img
):
# convert our input image to a floating point data type and then
# compute the Harris corner matrix
gray
=
np
.
float32
(
img
)
H
=
cv2
.
cornerHarris
(
gray
,
self
.
blockSize
,
self
.
apertureSize
,
self
.
k
)
# for every (x, y)-coordinate where the Harris value is above the
# threshold, create a keypoint (the Harris detector returns
# keypoint size a 3-pixel radius)
kps
=
np
.
argwhere
(
H
>
self
.
T
*
H
.
max
())
kps
=
[
cv2
.
KeyPoint
(
pt
[
1
],
pt
[
0
],
3
)
for
pt
in
kps
]
# return the Harris keypoints
return
kps
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