delphi xe luxand7 检测人脸特征 代码
时间: 2024-02-15 16:05:12 浏览: 141
人脸检测代码
以下是使用 Delphi XE 和 Luxand FaceSDK 检测人脸特征的示例代码:
```
uses LuxandFaceSDK;
procedure TForm1.Button1Click(Sender: TObject);
var
hImage: HBITMAP;
faceCount: Integer;
faceArray: array of TFacePosition;
i: Integer;
begin
if (FSDK_ActivateLibrary('your Luxand FaceSDK key') <> FSDKE_OK) then
Exit;
OpenPictureDialog1.Execute;
Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
hImage := Image1.Picture.Bitmap.Handle;
SetLength(faceArray, 0);
if (FSDK_DetectFacialFeatures(hImage, @faceArray[0], Length(faceArray)) <> FSDKE_OK) then
Exit;
faceCount := Length(faceArray);
for i := 0 to faceCount - 1 do
begin
//faceArray[i].x - x coordinate of the top-left corner of the rectangle
//faceArray[i].y - y coordinate of the top-left corner of the rectangle
//faceArray[i].width - rectangle width
//faceArray[i].height - rectangle height
//faceArray[i].angle - face tilt angle
//faceArray[i].leftEye.x - x coordinate of the left eye
//faceArray[i].leftEye.y - y coordinate of the left eye
//faceArray[i].rightEye.x - x coordinate of the right eye
//faceArray[i].rightEye.y - y coordinate of the right eye
//faceArray[i].nose.x - x coordinate of the nose
//faceArray[i].nose.y - y coordinate of the nose
//faceArray[i].mouth.x - x coordinate of the mouth
//faceArray[i].mouth.y - y coordinate of the mouth
//faceArray[i].jaw.x - x coordinate of the jaw
//faceArray[i].jaw.y - y coordinate of the jaw
end;
end;
```
这个示例将打开一个对话框,允许您选择一张图片。然后,它将使用 Luxand FaceSDK 检测人脸特征,并将每个检测到的人脸位置和特征信息存储在 faceArray 数组中。你可以根据需要使用 faceArray 数组中的信息。
阅读全文