Wie um Punkte zu bekommen-Koordinate der position im Gesicht Wahrzeichen ein Programm zur Erkennung von dlib?

Es ist ein Beispiel python-Programm in dlib zu erkennen, das Gesicht Wahrzeichen position.
face_landmark_detection.py

Diesem Programm erkennt das Gesicht Funktion und bezeichnen Sie die Sehenswürdigkeiten mit Punkten und Linien im original-Foto.

Frage ich mich, ob es möglich ist, um die einzelnen Punkte' - Koordinate der position. Wie ein(10, 25). 'a' bezeichnet Mundwinkel.

Nach etwas Modifizierung des Programms für die Verarbeitung eines Bildes auf einmal, ich versuche, drucken Sie den Wert von dets und Form, ohne Erfolg.

>>>print(dets)
<dlib.dlib.rectangles object at 0x7f3eb74bf950>
>>>print(dets[0])
[(1005, 563) (1129, 687)]

Argumente zu bezeichnen, Gesicht Wahrzeichen Punkte und der Datentyp der Argumente, die immer noch unbekannt bleiben.
Und hier der vereinfachte code

import dlib
from skimage import io

#shape_predictor_68_face_landmarks.dat is the train dataset in the same directory
predictor_path = "shape_predictor_68_face_landmarks.dat"

detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(predictor_path)
win = dlib.image_window()

#FDT.jpg is the picture file to be processed in the same directory
img = io.imread("FDT.jpg")

win.set_image(img)

dets = detector(img)

print("Number of faces detected: {}".format(len(dets)))
for k, d in enumerate(dets):
    print("Detection {}: Left: {} Top: {} Right: {} Bottom: {}".format(
        k, d.left(), d.top(), d.right(), d.bottom()))
    # Get the landmarks/parts for the face in box d.
    shape = predictor(img, d)
    #print(shape)
    print("Part 0: {}, Part 1: {} ...".format(shape.part(0),
                                              shape.part(1)))
# Draw the face landmarks on the screen.
win.add_overlay(shape)

win.add_overlay(dets)
dlib.hit_enter_to_continue()

---------------------------update auf 3.10.2016---------------------------

Heute erinnere ich mich an die help () - Methode in python und habe eine Testversion mit.

>>>help(predictor)

Help on shape_predictor in module dlib.dlib object:

class shape_predictor(Boost.Python.instance)
 |  This object is a tool that takes in an image region containing 
some object and outputs a set of point locations that define the pose 
of the object. The classic example of this is human face pose 
prediction, where you take an image of a human face as input and are
expected to identify the locations of important facial landmarks such
as the corners of the mouth and eyes, tip of the nose, and so forth.

In den originalen code, variable shape ist die Ausgabe des Indikator-Methode.

>>>help(shape)

Die Beschreibung der Form

class full_object_detection(Boost.Python.instance)
 |  This object represents the location of an object in an image along 
with the positions of each of its constituent parts.
----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  num_parts
 |      The number of parts of the object.
 |  
 |  rect
 |      The bounding box of the parts.
 |  
 |  ----------------------------------------------------------------------

Es scheint, dass die variable shape steht in Verbindung mit Punkte-Koordinate der position.

>>>print(shape.num_parts)
68
>>>print(shape.rect)
[(1005, 563) (1129, 687)]

Ich nehme an, es sind 68 bezeichnet Gesicht Wahrzeichen Punkte.

>>> print(shape.part(68))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: Index out of range
>>> print(shape.part(65))
(1072, 645)
>>> print(shape.part(66))
(1065, 647)
>>> print(shape.part(67))
(1059, 646)

Wenn es wahr ist. Das bleibende problem ist, dass das Teil reagiert auf das Gesicht Wahrzeichen zeigen.

Sie können erkennen, Punkte und ziehen Ihre Nummern auf dem Bild. oder Sie können schauen Sie hier, matthewearl.github.io/2015/07/28/Schalt-eds-mit-python
Wow, das ist eine gute Idee.
Überprüfen Sie hier, pyimagesearch.com/2017/04/03/...

InformationsquelleAutor randy Pen | 2016-09-30

Schreibe einen Kommentar