Javascript 使用face-api.js和Photoshop时出现问题
我正在构建一个photoshop插件,能够使用face-api.js检测人脸地标。它似乎只适用于浏览器,但在photoshop中存在一些问题。当它到达行Javascript 使用face-api.js和Photoshop时出现问题,javascript,photoshop,face-api,Javascript,Photoshop,Face Api,我正在构建一个photoshop插件,能够使用face-api.js检测人脸地标。它似乎只适用于浏览器,但在photoshop中存在一些问题。当它到达行wait faceapi.detectSingleFace(image).withFaceLandmarks()时停止工作,但不返回任何错误 这是我的功能,以获取68点: var all_points = []; async function promise(){ await faceapi.nets.faceRecog
wait faceapi.detectSingleFace(image).withFaceLandmarks()
时停止工作,但不返回任何错误
这是我的功能,以获取68点:
var all_points = [];
async function promise(){
await faceapi.nets.faceRecognitionNet.loadFromUri('http://localhost:3000/models'),
await faceapi.nets.faceLandmark68Net.loadFromUri('http://localhost:3000/models'),
await faceapi.nets.ssdMobilenetv1.loadFromUri('http://localhost:3000/models')
}
promise();
async function takePoints(){
alert('takepoints!') #this works
var img = await fetch(path_img)
var myBlob = await img.blob()
var image = await faceapi.bufferToImage(myBlob)
alert(image.src) #this works
var displaySize = { width: image.width, height: image.height }
var detections = await faceapi.detectSingleFace(image).withFaceLandmarks()
alert(detections.landmarks) #not working
var resizedDetections = await faceapi.resizeResults(detections, displaySize)
var all_points = resizedDetections.landmarks._positions
alert(all_points)
return all_points
}
document.getElementById("my-btn").addEventListener('click', takePoints)
我不知道这是否有效或有帮助,因为我对所有这些脚本编写的东西都是新手,不太了解,但这里是我的建议 可能您必须在
var detections=等待faceapi.detectSingleFace(图像)。withFaceLandmarks()
var landmarks=wait faceapi.detectFaceLandmarks(图像)
我想我在使用
等待faceapi.DetectIngleFace(图像)。withFaceLandmarks()
请尝试此操作等待faceapi.detectAllFaces(图像).withFaceLandmarks()
如果你能告诉我这是否对你有帮助或者你的项目进展顺利,我将非常感激。
这正是我想建立的东西(是的,我知道,我是一个完全的初学者)
到目前为止,我设法在一个文件夹中处理多幅图像,并将地标位置导出到csv,然后将图像保存到一个新文件夹中,并在其中绘制人脸检测和地标。现在没有Photoshop
我的目标是通过Photoshop在精确的地标位置(xy坐标)上裁剪图像。我必须处理成千上万的图像,不想手工裁剪。在坐标的帮助下,它可以自动化(我希望)
所以在Photoshop中有这个脚本会很好。
还不知道怎么做,但我马上就到了。
你能帮忙吗?我不知道这是否有效,因为我对所有的脚本编写都是新手,不太了解,但这里是我的建议 可能您必须在
var detections=等待faceapi.detectSingleFace(图像)。withFaceLandmarks()
var landmarks=wait faceapi.detectFaceLandmarks(图像)
我想我在使用
等待faceapi.DetectIngleFace(图像)。withFaceLandmarks()
请尝试此操作等待faceapi.detectAllFaces(图像).withFaceLandmarks()
如果你能告诉我这是否对你有帮助或者你的项目进展顺利,我将非常感激。
这正是我想建立的东西(是的,我知道,我是一个完全的初学者)
到目前为止,我设法在一个文件夹中处理多幅图像,并将地标位置导出到csv,然后将图像保存到一个新文件夹中,并在其中绘制人脸检测和地标。现在没有Photoshop
我的目标是通过Photoshop在精确的地标位置(xy坐标)上裁剪图像。我必须处理成千上万的图像,不想手工裁剪。在坐标的帮助下,它可以自动化(我希望)
所以在Photoshop中有这个脚本会很好。
还不知道怎么做,但我马上就到了。
你能帮忙吗