Skip to content
Snippets Groups Projects
Commit 79d580bb authored by fouad5's avatar fouad5
Browse files

pass cv-image in stead of path of image to recognizer function

parent 89818275
No related branches found
No related tags found
No related merge requests found
......@@ -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))
src/features_detection/result.jpg

18 KiB | W: | H:

src/features_detection/result.jpg

18.5 KiB | W: | H:

src/features_detection/result.jpg
src/features_detection/result.jpg
src/features_detection/result.jpg
src/features_detection/result.jpg
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment