package facepp import ( "encoding/json" "fmt" ) // SkinAnalyzeOptions 专业版请求参数。 type SkinAnalyzeOptions struct { ImageURL string ImageBase64 string ImageFile string ReturnMaps string ReturnMarks string } type APIError struct { TimeUsed int `json:"time_used"` RequestID string `json:"request_id"` ErrorMessage string `json:"error_message"` } func (e *APIError) Error() string { if e.RequestID == "" { return fmt.Sprintf("facepp: %s", e.ErrorMessage) } return fmt.Sprintf("facepp: %s (request_id=%s)", e.ErrorMessage, e.RequestID) } type SkinAnalyzeResponse struct { RequestID string `json:"request_id"` TimeUsed int `json:"time_used"` ErrorMessage string `json:"error_message"` ImageID string `json:"image_id"` FaceRectangle FaceRectangle `json:"face_rectangle"` Result json.RawMessage `json:"result"` LeftSideResult json.RawMessage `json:"left_side_result"` RightSideResult json.RawMessage `json:"right_side_result"` FaceMaps FaceMaps `json:"face_maps,omitempty"` Warning []string `json:"warning,omitempty"` } type FaceRectangle struct { Top int `json:"top"` Left int `json:"left"` Width int `json:"width"` Height int `json:"height"` } type FlagResult struct { Value int `json:"value"` Confidence float64 `json:"confidence"` } type LocatedResult struct { Value int `json:"value"` Confidence float64 `json:"confidence"` Rect []Rect `json:"rect,omitempty"` } type Rect struct { Top int `json:"top"` Left int `json:"left"` Width int `json:"width"` Height int `json:"height"` } type SkinTypeResult struct { SkinType int `json:"skin_type"` Details map[string]FlagResult `json:"details"` } type DarkCircleResult struct { Value int `json:"value"` Confidence float64 `json:"confidence"` DarkCircleType int `json:"dark_circle_type"` } type SkinAgeResult struct { Value int `json:"value"` } type FineLineRegion struct { Count int `json:"count"` Area float64 `json:"area"` } type FineLineResult struct { Value int `json:"value"` Forehead FineLineRegion `json:"forehead"` UnderEye FineLineRegion `json:"under_eye"` } type FaceMaps struct { RedArea string `json:"red_area,omitempty"` BrownArea string `json:"brown_area,omitempty"` TextureEnhancedPores string `json:"texture_enhanced_pores,omitempty"` TextureEnhancedLines string `json:"texture_enhanced_lines,omitempty"` } type AnalyzeResult struct { SkinType SkinTypeResult `json:"skin_type"` OilyIntensity FlagResult `json:"oily_intensity"` SkinColor FlagResult `json:"skin_color"` SkinTone FlagResult `json:"skin_tone"` Sensitivity FlagResult `json:"sensitivity"` ClosedComedones LocatedResult `json:"closed_comedones"` Blackhead FlagResult `json:"blackhead"` BlackheadCount int `json:"blackhead_count"` Mole LocatedResult `json:"mole"` SkinSpot LocatedResult `json:"skin_spot"` Acne LocatedResult `json:"acne"` DarkCircle DarkCircleResult `json:"dark_circle"` EyePouch FlagResult `json:"eye_pouch"` ForeheadWrinkle FlagResult `json:"forehead_wrinkle"` CrowsFeet FlagResult `json:"crows_feet"` EyeFinelines FlagResult `json:"eye_finelines"` GlabellaWrinkle FlagResult `json:"glabella_wrinkle"` NasolabialFold FlagResult `json:"nasolabial_fold"` PoresForehead FlagResult `json:"pores_forehead"` PoresLeftCheek FlagResult `json:"pores_left_cheek"` PoresRightCheek FlagResult `json:"pores_right_cheek"` PoresJaw FlagResult `json:"pores_jaw"` SkinAge SkinAgeResult `json:"skin_age"` FineLine FineLineResult `json:"fine_line"` Melanin FlagResult `json:"melanin"` }