Skip to content
Snippets Groups Projects
Commit 6cc7f6c0 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Fix plots lines disappearing

parent 1503bf8e
No related branches found
No related tags found
1 merge request!14Fix left eye right eye landmarks
......@@ -3,7 +3,6 @@ import bob.io.image
import bob.io.base.test_utils
import bob.ip.dlib
import numpy
import os
from matplotlib import pyplot
import bob.ip.draw
from bob.ip.facedetect import BoundingBox
......
......@@ -2,14 +2,10 @@ import bob.io.base
import bob.io.image
import bob.io.base.test_utils
import bob.ip.dlib
import pkg_resources
import os
from matplotlib import pyplot
from matplotlib.patches import Rectangle
import bob.ip.draw
#print "###################################"
#print os.path.join(pkg_resources.resource_filename(__name__, 'data'), 'multiple-faces.jpg')
# detect multiple dlib
image = bob.io.base.load(bob.io.base.test_utils.datafile('testimage.jpg', 'bob.ip.facedetect'))
bob_image = bob.io.base.load(bob.io.base.test_utils.datafile('testimage.jpg', 'bob.ip.facedetect'))
......@@ -22,23 +18,20 @@ points = detector(image)
bob_detector = bob.ip.dlib.DlibLandmarkExtraction(bob_landmark_format=True)
bob_points = bob_detector(bob_image)
for p in points:
bob.ip.draw.plus(image, p, radius=10, color=(255, 0, 0))
for p in bob_points:
bob.ip.draw.plus(bob_image, bob_points[p], radius=10, color=(255, 0, 0))
# face detections
bob.ip.draw.box(image, bounding_box.topleft, bounding_box.size, color=(255, 0, 0))
ax = pyplot.subplot(1, 2, 1)
ax.set_title("Dlib landmarks")
pyplot.imshow(bob.io.image.to_matplotlib(image).astype("uint8"))
bob.io.image.imshow(image.astype("uint8"))
pyplot.axis('off')
x = [p[1] for p in points]
y = [p[0] for p in points]
pyplot.plot(x, y, '+', color='r')
ax.add_patch(Rectangle(bounding_box.topleft[::-1], bounding_box.size[1], bounding_box.size[0], edgecolor='r', facecolor='none'))
ax = pyplot.subplot(1, 2, 2)
ax.set_title("Dlib landmarks for Bob")
pyplot.imshow(bob.io.image.to_matplotlib(bob_image).astype("uint8"))
bob.io.image.imshow(bob_image.astype("uint8"))
pyplot.axis('off')
x = [p[1] for p in bob_points.values()]
y = [p[0] for p in bob_points.values()]
pyplot.plot(x, y, '+', color='r')
......@@ -2,14 +2,11 @@ import bob.io.base
import bob.io.image
import bob.io.base.test_utils
import bob.ip.dlib
import pkg_resources
import os
from matplotlib import pyplot
from matplotlib.patches import Rectangle
import bob.ip.draw
import bob.ip.facedetect
#print "###################################"
#print os.path.join(pkg_resources.resource_filename(__name__, 'data'), 'multiple-faces.jpg')
# detect multiple bob
bob_color_image = bob.io.base.load(bob.io.base.test_utils.datafile('multiple-faces.jpg', 'bob.ip.dlib'))
......@@ -20,19 +17,18 @@ dlib_color_image = bob.io.base.load(bob.io.base.test_utils.datafile('multiple-fa
dlib_bounding_box, _ = bob.ip.dlib.FaceDetector().detect_all_faces(dlib_color_image)
# create figure
for b in bob_bounding_box:
bob.ip.draw.box(bob_color_image, b.topleft, b.size, color=(255, 0, 0))
for b in dlib_bounding_box:
bob.ip.draw.box(dlib_color_image, b.topleft, b.size, color=(255, 0, 0))
ax = pyplot.subplot(1, 2, 1)
ax.set_title("Dlib")
ax.set_title("bob.ip.dlib")
pyplot.imshow(bob.io.image.to_matplotlib(dlib_color_image).astype("uint8"))
pyplot.axis('off')
for b in dlib_bounding_box:
ax.add_patch(Rectangle(b.topleft[::-1], b.size[1], b.size[0], edgecolor='r', facecolor='none'))
ax = pyplot.subplot(1, 2, 2)
ax.set_title("Bob")
ax.set_title("bob.ip.facedetect")
pyplot.imshow(bob.io.image.to_matplotlib(bob_color_image).astype("uint8"))
pyplot.axis('off')
for b in bob_bounding_box:
ax.add_patch(Rectangle(b.topleft[::-1], b.size[1], b.size[0], edgecolor='r', facecolor='none'))
......@@ -2,15 +2,11 @@ import bob.io.base
import bob.io.image
import bob.io.base.test_utils
import bob.ip.dlib
import pkg_resources
import os
from matplotlib import pyplot
from matplotlib.patches import Rectangle
import bob.ip.draw
import bob.ip.facedetect
#print "###################################"
#print os.path.join(pkg_resources.resource_filename(__name__, 'data'), 'multiple-faces.jpg')
# detect multiple bob
bob_color_image = bob.io.base.load(bob.io.base.test_utils.datafile('testimage.jpg', 'bob.ip.facedetect'))
bob_bounding_box, _ = bob.ip.facedetect.detect_single_face(bob_color_image)
......@@ -20,17 +16,18 @@ dlib_color_image = bob.io.base.load(bob.io.base.test_utils.datafile('testimage.j
dlib_bounding_box, _ = bob.ip.dlib.FaceDetector().detect_single_face(dlib_color_image)
# create figure
bob.ip.draw.box(bob_color_image, bob_bounding_box.topleft, bob_bounding_box.size, color=(255, 0, 0))
# bob.ip.draw.box(bob_color_image, bob_bounding_box.topleft, bob_bounding_box.size, color=(255, 0, 0))
bob.ip.draw.box(dlib_color_image, dlib_bounding_box.topleft, dlib_bounding_box.size, color=(255, 0, 0))
# bob.ip.draw.box(dlib_color_image, dlib_bounding_box.topleft, dlib_bounding_box.size, color=(255, 0, 0))
ax = pyplot.subplot(1, 2, 1)
ax.set_title("Dlib")
ax.set_title("bob.ip.dlib")
pyplot.imshow(bob.io.image.to_matplotlib(dlib_color_image).astype("uint8"))
pyplot.axis('off')
ax.add_patch(Rectangle(dlib_bounding_box.topleft[::-1], dlib_bounding_box.size[1], dlib_bounding_box.size[0], edgecolor='r', facecolor='none'))
ax = pyplot.subplot(1, 2, 2)
ax.set_title("Bob")
ax.set_title("bob.ip.facedetect")
pyplot.imshow(bob.io.image.to_matplotlib(bob_color_image).astype("uint8"))
pyplot.axis('off')
ax.add_patch(Rectangle(bob_bounding_box.topleft[::-1], bob_bounding_box.size[1], bob_bounding_box.size[0], edgecolor='r', facecolor='none'))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment