Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
XRD
darfix
Commits
42e0dfbd
Commit
42e0dfbd
authored
Feb 28, 2020
by
Julia Garriga Ferrer
Browse files
[core][components matching] Cleaning
parent
d773e20c
Pipeline
#22169
passed with stage
in 2 minutes and 26 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
darfix/core/componentsMatching.py
View file @
42e0dfbd
...
...
@@ -26,7 +26,7 @@
__authors__
=
[
"J. Garriga"
]
__license__
=
"MIT"
__date__
=
"2
1
/0
1
/2020"
__date__
=
"2
8
/0
2
/2020"
import
cv2
import
numpy
...
...
@@ -218,29 +218,6 @@ class ComponentsMatching():
assert
all
((
isinstance
(
match
,
cv2
.
DMatch
)
for
match
in
values
)
for
values
in
matches
.
values
()),
\
"Dictionary `matches` has to contain values of type `cv2.DMatch`"
"""
if len(matches[(i, j)])>MIN_MATCH_COUNT:
kp2 = self.components[id2][j].keypoints
src_pts = numpy.float32([kp1[m.queryIdx].pt for m in matches[(i, j)]]).reshape(-1,1,2)
dst_pts = numpy.float32([kp2[m.trainIdx].pt for m in matches[(i, j)]]).reshape(-1,1,2)
M, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC,5.0)
matchesMask = mask.ravel().tolist()
h,w = component.image.shape
pts = numpy.float32([ [0,0],[0,h-1],[w-1,h-1],[w-1,0] ]).reshape(-1,1,2)
dst = cv2.perspectiveTransform(pts,M)
img2 = cv2.polylines(img2,[numpy.int32(dst)],True,255,3, cv2.LINE_AA)
else:
print("Not enough matches are found - %d/%d" % (len(matches[(i,j)]),MIN_MATCH_COUNT))
matchesMask = None
draw_params = dict(matchColor = (0,255,0), # draw matches in green color
singlePointColor = None,
matchesMask = matchesMask, # draw only inliers
flags = 2)"""
img
=
cv2
.
drawMatches
(
self
.
descriptors
[
id1
][
i
].
image
,
self
.
descriptors
[
id1
][
i
].
keypoints
,
...
...
Write
Preview
Supports
Markdown
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