public void UpdateMultiFaceInfo(ASF_MultiFaceInfo multiFaceInfo) { ASFMultiFaceInfo = multiFaceInfo; faceNum = multiFaceInfo.faceNum; if (faceNum == 0) { return; } var mrectSize = Marshal.SizeOf <MRECT>(); var facedatainfoSize = Marshal.SizeOf <ASF_FaceDataInfo>(); var _faceOrients = new int[faceNum]; if (multiFaceInfo.faceOrient != IntPtr.Zero) { Marshal.Copy(multiFaceInfo.faceOrient, _faceOrients, 0, faceNum); } var _faceId = new int[faceNum]; if (multiFaceInfo.faceID != IntPtr.Zero) { Marshal.Copy(multiFaceInfo.faceID, _faceId, 0, faceNum); } var _wearGlasses = new float[faceNum]; if (multiFaceInfo.wearGlasses != IntPtr.Zero) { Marshal.Copy(multiFaceInfo.wearGlasses, _wearGlasses, 0, faceNum); } var _faceShelter = new int[faceNum]; if (multiFaceInfo.faceShelter != IntPtr.Zero) { Marshal.Copy(multiFaceInfo.faceShelter, _faceShelter, 0, faceNum); } var _leftEyeClosed = new int[faceNum]; if (multiFaceInfo.leftEyeClosed != IntPtr.Zero) { Marshal.Copy(multiFaceInfo.leftEyeClosed, _leftEyeClosed, 0, faceNum); } var _rightEyeClosed = new int[faceNum]; if (multiFaceInfo.rightEyeClosed != IntPtr.Zero) { Marshal.Copy(multiFaceInfo.rightEyeClosed, _rightEyeClosed, 0, faceNum); } for (int i = 0; i < multiFaceInfo.faceNum; i++) { var rect = Marshal.PtrToStructure <MRECT>(IntPtr.Add(multiFaceInfo.faceRect, i * mrectSize)); faceRects.Add(rect); ASF_FaceDataInfo faceData = new ASF_FaceDataInfo(); if (multiFaceInfo.faceDataInfoList != IntPtr.Zero) { faceData = Marshal.PtrToStructure <ASF_FaceDataInfo>(IntPtr.Add(multiFaceInfo.faceDataInfoList, i * facedatainfoSize)); FaceDataInfos.Add(faceData); } var fo = (ArcSoftFace_OrientCode)_faceOrients[i]; faceOrients.Add(fo); var wg = _wearGlasses[i] > 0.5; WearGlasses.Add(wg); var fs = _faceShelter[i] == 1; FaceShelter.Add(fs); var lec = _leftEyeClosed[i] == 1; LeftEyeClosed.Add(lec); var rec = _rightEyeClosed[i] == 1; RightEyeClosed.Add(rec); var fi = _faceId[i]; faceID.Add(fi); FaceInfos.Add(new SingleFaceInfo { ASFSingleFaceInfo = new ASF_SingleFaceInfo { faceDataInfo = faceData, faceOrient = _faceOrients[i], faceRect = rect }, FaceID = fi, FaceOrient = fo, FaceRect = rect, FaceShelter = fs, LeftEyeClosed = lec, RightEyeClosed = rec, WearGlasses = wg }); } }
public MultiFaceInfo(ASF_MultiFaceInfo multiFaceInfo) { UpdateMultiFaceInfo(multiFaceInfo); }