<div dir="ltr"><div dir="ltr"> Hi Jacopo,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 31, 2024 at 10:09 PM Jacopo Mondi <<a href="mailto:jacopo.mondi@ideasonboard.com" target="_blank">jacopo.mondi@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Harvey<br>
On Fri, Aug 30, 2024 at 09:00:20PM GMT, Harvey Yang wrote:<br>
> From: Yudhistira Erlandinata <<a href="mailto:yerlandinata@chromium.org" target="_blank">yerlandinata@chromium.org</a>><br>
><br>
> Add FaceDetectMode, FaceDetectFaceRectangles, FaceDetectFaceScores,<br>
> and FaceDetectFaceLandmark. Also add ControlTypePoint for supporting<br>
> FaceDetectFaceLandmark.<br>
><br>
> Signed-off-by: Yudhistira Erlandinata <<a href="mailto:yerlandinata@chromium.org" target="_blank">yerlandinata@chromium.org</a>><br>
> Co-developed-by: becker hsieh <<a href="mailto:beckerh@chromium.org" target="_blank">beckerh@chromium.org</a>><br>
> Co-developed-by: Harvey Yang <<a href="mailto:chenghaoyang@chromium.org" target="_blank">chenghaoyang@chromium.org</a>><br>
> ---<br>
>  include/libcamera/controls.h         |  6 +++<br>
>  src/libcamera/control_ids_draft.yaml | 63 ++++++++++++++++++++++++++++<br>
>  src/libcamera/controls.cpp           |  6 +++<br>
>  3 files changed, 75 insertions(+)<br>
><br>
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h<br>
> index 7c2bb2872..bf1b8609c 100644<br>
> --- a/include/libcamera/controls.h<br>
> +++ b/include/libcamera/controls.h<br>
> @@ -34,6 +34,7 @@ enum ControlType {<br>
>       ControlTypeString,<br>
>       ControlTypeRectangle,<br>
>       ControlTypeSize,<br>
> +     ControlTypePoint,<br>
>  };<br>
><br>
>  namespace details {<br>
> @@ -87,6 +88,11 @@ struct control_type<Size> {<br>
>       static constexpr ControlType value = ControlTypeSize;<br>
>  };<br>
><br>
> +template<><br>
> +struct control_type<Point> {<br>
> +     static constexpr ControlType value = ControlTypePoint;<br>
> +};<br>
> +<br>
>  template<typename T, std::size_t N><br>
>  struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {<br>
>  };<br>
> diff --git a/src/libcamera/control_ids_draft.yaml b/src/libcamera/control_ids_draft.yaml<br>
> index 9bef5bf15..23e09bff8 100644<br>
> --- a/src/libcamera/control_ids_draft.yaml<br>
> +++ b/src/libcamera/control_ids_draft.yaml<br>
> @@ -227,4 +227,67 @@ controls:<br>
>              value. All of the custom test patterns will be static (that is the<br>
>              raw image must not vary from frame to frame).<br>
><br>
> +  - FaceDetectMode:<br>
> +      type: uint8_t<br>
> +      description: |<br>
> +        Reporting mode of face detection.<br>
> +<br>
> +      enum:<br>
> +        - name: FaceDetectModeOff<br>
> +          value: 0<br>
> +          description: |<br>
> +            Pipeline should not report face detection result.<br>
> +        - name: FaceDetectModeSimple<br>
> +          value: 1<br>
> +          description: |<br>
> +            Pipeline should at least report faces boundary rectangles, in<br>
> +            metadata FaceDetectFaceRectangles, and confidence score,<br>
> +            in metadata FaceDetectFaceScores, for each of them.<br>
> +            FaceDetectFaceLandmark is optional.<br>
> +<br>
> +            The number of faces in each list must be the same.<br>
> +<br>
> +            \sa FaceDetectFaceRectangles<br>
> +            \sa FaceDetectFaceScores<br>
> +            \sa FaceDetectFaceLandmark<br>
<br>
Currently identical to ANDROID_STATISTICS_FACE_DETECT_MODE ?<br></blockquote><div>Hmm, in this patch we lack the full mode. Let's add the full mode in the</div><div>control ids, without any pipeline handler supporting it.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> +<br>
> +  - FaceDetectFaceRectangles:<br>
> +      type: Rectangle<br>
> +      description: |<br>
> +        Boundary rectangle of the detected faces in format:<br>
> +        [..., xmin_i, ymin_i, xmax_i, ymax_i, ...], where (0,0) is top-left<br>
> +        of active pixel area.<br>
> +        The number of values should be 3 * the number of faces.<br>
> +<br>
> +        The FaceDetectFaceRectangles control can only be returned in metadata.<br>
<br>
Currently indendtical to ANDROID_STATISTICS_FACE_RECTANGLES ?<br></blockquote><div>Done</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> +<br>
> +      size: [n]<br>
> +<br>
> +  - FaceDetectFaceScores:<br>
> +      type: uint8_t<br>
> +      description: |<br>
> +        Confidence score of each of the detected faces by face detector.<br>
> +        The range of score is [0, 100].<br>
> +        The FaceDetectFaceScores control can only be returned in metadata.<br>
> +        The number of values should be the number of faces.<br>
> +<br>
> +        Currently identical to ANDROID_STATISTICS_FACE_SCORES.<br>
> +<br>
> +      size: [n]<br>
> +<br>
> +  - FaceDetectFaceLandmark:<br>
> +      type: Point<br>
> +      description: |<br>
> +        Array of human face landmark coordinates in format:<br>
> +        [..., left_eye_i, right_eye_i, mouth_i, left_eye_i+1, ...],<br>
> +        with i = index of face.<br>
> +        The number of values should be 6 * the number of faces.<br>
> +<br>
> +        The FaceDetectFaceLandmark control can only be returned in metadata.<br>
> +<br>
> +        Currently identical to ANDROID_STATISTICS_FACE_LANDMARKS.<br>
> +<br>
> +      size: [n]<br>
> +<br>
> +<br>
<br>
Additional empy line<br></blockquote><div>Removed.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
>  ...<br>
> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp<br>
> index 11d35321c..ce73ae9d7 100644<br>
> --- a/src/libcamera/controls.cpp<br>
> +++ b/src/libcamera/controls.cpp<br>
> @@ -61,6 +61,7 @@ static constexpr size_t ControlValueSize[] = {<br>
>       [ControlTypeString]             = sizeof(char),<br>
>       [ControlTypeRectangle]          = sizeof(Rectangle),<br>
>       [ControlTypeSize]               = sizeof(Size),<br>
> +     [ControlTypePoint]              = sizeof(Point),<br>
>  };<br>
><br>
>  } /* namespace */<br>
> @@ -255,6 +256,11 @@ std::string ControlValue::toString() const<br>
>                       str += value->toString();<br>
>                       break;<br>
>               }<br>
> +             case ControlTypePoint: {<br>
> +                     const Point *value = reinterpret_cast<const Point *>(data);<br>
> +                     str += value->toString();<br>
> +                     break;<br>
> +             }<br>
>               case ControlTypeNone:<br>
>               case ControlTypeString:<br>
>                       break;<br>
> --<br>
> 2.46.0.469.g59c65b2a67-goog<br>
><br>
</blockquote></div></div>