In Part 2, I drew the mask by hand as a rectangle. This time, Photoshot builds a skin mask from the source photo. The goal is to control where a skin correction can reach, especially around the eyes and lips.
112 · Analyze the source once
MediaPipe Face Landmarker returns 478 points for each detected face. Image Segmenter supplies separate confidence maps for face and body skin. Photoshot caches those results within the job so each tool works from the same source analysis.
113 · Protect the eyes and lips
Photoshot uses the landmark contours to make an eye and lip protection mask. All Skin adds the face and body skin scores, then multiplies the sum by one minus the protection weight. Face and Outside the Face use their individual confidence maps. Sensitivity scales the mask weights, and Refine softens the edges with a Gaussian blur.
114 · Read the saved mask
In the 512 × 512 test portrait, the eye at (204, 101) and the lips at (223, 145) both had a face-skin score of about 0.915. The protection weight was 1 at both points, and the final 8-bit All Skin PNG stored 0 at both points.
The detector returned two sets of landmarks when I placed two copies of the same face crop side by side. It returned none when I placed two full copies of the portrait side by side. I check the landmarks and the protection map before relying on the mask in a group shot.
Top comments (0)