How to access People album used in Apple's Photos app

痞子三分冷 提交于 2020-06-12 04:54:25

问题


Apple's Photo app has facial recognition capabilities. I would like to know if an API exists to access the associated data for photos which have been classified by the app.

(tagged with API, not sure which tags.)

Thanks!


回答1:


Apple released an SDK for accessing Apple Photos called Photo Kit. In the documentation, you will find API access to the photos application and photos cloud. However, if you are looking for an HTTP API I do not believe one has been announced publicly.

If you only need access to is data on Photos MacOS app I would recommend digging through the SQLite photos.db located in the photos library database directory.

/Users/[yourUserName]/Pictures/Photos Library.photoslibrary/database/photos.db

I am working on a project this weekend that requires similar face data and will document my progress. Here is a sample SQLite query you can use to get all faces, photos, and corresponding person:

SELECT *, RKFace.modelId AS fId
FROM RKFace
JOIN RKMaster ON RKMaster.modelId = RKFace.imageModelId
LEFT JOIN RKFaceGroup ON RKFaceGroup.modelId = RKFace.faceGroupId
LEFT JOIN RKFaceCrop ON RKFaceCrop.faceId = RKFace.imageModelId
LEFT JOIN RKFacePrint ON RKFacePrint.faceId = RKFace.imageModelId
LEFT JOIN RKPerson ON RKPerson.modelId = RKFace.personId;

I hope this helps. :-)



来源:https://stackoverflow.com/questions/42869608/how-to-access-people-album-used-in-apples-photos-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!