Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
garbage-bot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Admin message
Setting up 2FA is now mandatory for all users.
Show more breadcrumbs
Mathieu Reymond
garbage-bot
Commits
79d580bb
Commit
79d580bb
authored
7 years ago
by
fouad5
Browse files
Options
Downloads
Patches
Plain Diff
pass cv-image in stead of path of image to recognizer function
parent
89818275
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/features_detection/recognizer.py
+13
-9
13 additions, 9 deletions
src/features_detection/recognizer.py
src/features_detection/result.jpg
+0
-0
0 additions, 0 deletions
src/features_detection/result.jpg
with
13 additions
and
9 deletions
src/features_detection/recognizer.py
+
13
−
9
View file @
79d580bb
...
...
@@ -48,7 +48,7 @@ def getCroppedImage(image):
#image2 = imread("/path/to/image2")
# image3 = im1 - im
img
=
cv2
.
imread
(
image
)
img
=
image
#
cv2.imread(image)
# Crop from x, y, w, h -> 100, 200, 300, 400
# NOTE: its img[y: y + h, x: x + w] and *not* img[x: x + w, y: y + h]
...
...
@@ -91,11 +91,15 @@ def getNegative(img):
return
img
def
getFeatures
(
path
):
def
getFeatures
(
image
):
size
=
shape
=
color
=
""
copy
=
image
img
=
getCroppedImage
(
path
)
img
=
getCroppedImage
(
image
)
img
=
getNegative
(
img
)
# find object
detection
=
detecting
(
img
)
...
...
@@ -109,7 +113,7 @@ def getFeatures (path):
size
=
"
SMALL
"
img
=
getCroppedImage
(
path
)
img
=
getCroppedImage
(
copy
)
# img = cv2.imread(path)
...
...
@@ -146,9 +150,9 @@ def getFeatures (path):
#Finally remove the background
img
[
mask
]
=
0
;
fname
=
path
.
split
(
'
/
'
)[
-
1
]
cv2
.
imwrite
(
'
output/
'
+
fname
,
img
);
#
fname = path.split('/')[-1]
#
cv2.imwrite('output/' + fname, img);
#cv2.imshow("Image", img)
...
...
@@ -202,9 +206,9 @@ def getFeatures (path):
return
{
'
shape
'
:
shape
,
'
color
'
:
color
,
'
size
'
:
size
}
print
(
getFeatures
(
'
cube.jpg
'
))
image
=
cv2
.
imread
(
'
sphere3.jpg
'
)
print
(
getFeatures
(
image
))
This diff is collapsed.
Click to expand it.
src/features_detection/result.jpg
+
0
−
0
View replaced file @
89818275
View file @
79d580bb
18 KiB
|
W:
|
H:
18.5 KiB
|
W:
|
H:
2-up
Swipe
Onion skin
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