-
Notifications
You must be signed in to change notification settings - Fork 0
/
photo.go
32 lines (28 loc) · 1.07 KB
/
photo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package phace
// Photo record in the library, references an image on disk.
type Photo struct {
UUID string `db:"uuid"`
MasterUUID string `db:"masterUuid"`
Fingerprint string `db:"fingerprint"`
// Path to the image on disk, relative to the library root.
Path string `db:"imagePath"`
Height int `db:"masterHeight"`
Width int `db:"masterWidth"`
Orientation int `db:"orientation"`
Type int `db:"type"`
HasAdjustments bool `db:"hasAdjustments"`
}
// Faces gets the recognized faces in the photo.
func (p *Photo) Faces(s *Session) ([]*Face, error) {
faces := make([]*Face, 0)
err := s.PersonDB.Select(&faces, `
SELECT f.uuid, fg.uuid AS groupId, f.imageId, f.centerX, f.centerY, f.size,
f.leftEyeX, f.leftEyeY, f.rightEyeX, f.rightEyeY, f.mouthX, f.mouthY,
f.hasSmile, f.isBlurred, f.isLeftEyeClosed, f.isRightEyeClosed
FROM RKFace f
JOIN RKFaceGroupFace fgf ON fgf.faceId = f.modelId
JOIN RKFaceGroup fg ON fg.modelId = fgf.faceGroupId
WHERE f.imageId = ?
`, p.UUID)
return faces, err
}