Dlib Python library

Hi

I trying to use dlib python library for face landmark points, i wanna get them in to table dat

this code i take from Barracuda earlier he make post about open CV

[code]from imutils import face_utils
import imutils
import dlib
import cv2
import numpy as np
import matplotlib

mult = 1/255

width = 1/op(‘image’).width
height = 1/op(‘image’).height

detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(r"C:\Program Files\Derivative\TouchDesigner099\bin\Lib\site-packages\dlib-19.16.0-py3.5.egg-info\shape_predictor_68_face_landmarks.dat")

pointsTable = op(‘LandMarkPoints’)

def onCook(changeOp):
image = ((op(‘image’).numpyArray()[…,0])*255).astype(np.uint8)
rects = detector(image, 0)

for rect in rects:
shape = predictor(image, rect)
shape = face_utils.shape_to_np(shape)

  pointsTable.appendCol(shape[...,0] * width)
  pointsTable.appendCol(1-(shape[...,1] * height))

[/code]

i have issue with this line: image = ((op(‘image’).numpyArray()[…,0])*255).astype(np.uint8)

its says that ‘td.nullTOP’ object has no attribute ‘numpyArray’

i wanna know what i can do next to get that data inside my table, just any help with directions what to learn or see to understand what i need to do with that

Best regards

What build are you using? This feature was only recently added.

My build is TD099 2018.23120

For new one i think i need to buy license, and i read release there is no info about dlib or face landmarks, what features you talking about?

hey DmitryEvent,

numpyArray() was added as new method to the TOP class in Build 2018.25850, and
added to the CHOP class in Build 2018.26750

see docs.derivative.ca/Release_Notes

Great Thanks!!

PSA: You should have an upside-down mono image sent to that script. Also, a version that uses rgb is this:

image = ((op('null_image').numpyArray()[:,:,0:3]*255)).astype(np.uint8)