From patchwork Fri Aug 23 13:07:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 21000 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 064BBC323E for ; Fri, 23 Aug 2024 13:12:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BB962633D7; Fri, 23 Aug 2024 15:11:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ktcMMypC"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D9CB5633CF for ; Fri, 23 Aug 2024 15:11:51 +0200 (CEST) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-371a13c7c80so1710022f8f.0 for ; Fri, 23 Aug 2024 06:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1724418711; x=1725023511; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=djAA4idgeV6EJbCGqlIZlZ4tuy/a4YT0To9eKJrnat8=; b=ktcMMypCX116ulsdkkMUVmW4tTsK3soWh4kOfx9H2mlrrOj8jREtol1GnXFTk9nRk/ IBhvh03T9+lShAIViZtULLeEREwV+FR6PAqNkCCAkWJAQHBwroLBDnbWm1ClD/t3xDvN I+UFQ+xhfY2l8cwop4/PjezH/HF6mDjYseecQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724418711; x=1725023511; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=djAA4idgeV6EJbCGqlIZlZ4tuy/a4YT0To9eKJrnat8=; b=BKushf585WosiIA6UVwI+sBeudZ1aHAqxtL3zdtnOImnsEuMjac90xLcMq+kTsYSP2 RiNmdap0m08nA235jfz1v/eKkfVoZd0ZRehcDv+yyDrLo3x1iDKpdnOs9gXTb+LlJOzo FP+bkW/+Q9bRXDw72XjY3W7dPsRmUGUBtnsF0Dci3+2bxX44F4bIjGld4zRczcM4z7UX kfEdow9zgjfxha4ynptwuW0gpxM7vvONL5s9bdYqhdTopgpfBVUscc3PuuN2Hrs4PKp6 KocnsHfu8xZg9Jdje28cylAk0tPsagCXttsuBewdMccOvm4TtlCbAx2Ek1b8/HeaBC7z lxJg== X-Gm-Message-State: AOJu0YydQkS7t0hE8V2v3p7vZ1YjNnGNiVZUa2gNLdIxbTdt1rdq983r 5QcC9x5oq61mC5GjHxp/15nJWE3uHi3af/IJLrJ8/mOZsndyuqOShNeYdq4bzm0GxXuyokeCv0A f+Ulh X-Google-Smtp-Source: AGHT+IGpCzMe2L4WCd8wXBQD0tRXHQKzHWaedW9XIFKM8ATP5+DcQE7cB/hFAY0n+hAm6agE7JnoDQ== X-Received: by 2002:adf:ea06:0:b0:367:8fe2:7d8b with SMTP id ffacd0b85a97d-373052f4cf4mr3169466f8f.31.1724418711092; Fri, 23 Aug 2024 06:11:51 -0700 (PDT) Received: from chenghaoyang-germany.c.googlers.com.com (161.126.77.34.bc.googleusercontent.com. [34.77.126.161]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3730810ffb9sm4185000f8f.7.2024.08.23.06.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 06:11:50 -0700 (PDT) From: Harvey Yang X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Yudhistira Erlandinata , becker hsieh , Harvey Yang Subject: [PATCH v1 2/3] libcamera: Add face detection controls Date: Fri, 23 Aug 2024 13:07:34 +0000 Message-ID: <20240823131148.2449434-3-chenghaoyang@google.com> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog In-Reply-To: <20240823131148.2449434-1-chenghaoyang@google.com> References: <20240823131148.2449434-1-chenghaoyang@google.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Yudhistira Erlandinata Add FaceDetectMode, FaceDetectFaceRectangles, FaceDetectFaceScores, and FaceDetectFaceLandmark. Also add ControlTypePoint for supporting FaceDetectFaceLandmark. BUG=b:308713855 TEST=emerge-geralt libcamera-mtkisp7 Signed-off-by: Yudhistira Erlandinata Co-developed-by: becker hsieh Co-developed-by: Harvey Yang --- include/libcamera/controls.h | 6 +++++ src/libcamera/control_ids_core.yaml | 42 +++++++++++++++++++++++++++++ src/libcamera/controls.cpp | 6 +++++ 3 files changed, 54 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 7c2bb2872..bf1b8609c 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -34,6 +34,7 @@ enum ControlType { ControlTypeString, ControlTypeRectangle, ControlTypeSize, + ControlTypePoint, }; namespace details { @@ -87,6 +88,11 @@ struct control_type { static constexpr ControlType value = ControlTypeSize; }; +template<> +struct control_type { + static constexpr ControlType value = ControlTypePoint; +}; + template struct control_type> : public control_type> { }; diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml index 6381970b4..5ff46c71e 100644 --- a/src/libcamera/control_ids_core.yaml +++ b/src/libcamera/control_ids_core.yaml @@ -860,6 +860,48 @@ controls: No further state changes or lens movements will occur until the AfPauseResume control is sent. + - FaceDetectMode: + type: uint8_t + description: | + Reporting mode of face detection. + + enum: + - name: FaceDetectModeOff + value: 0 + description: | + Pipeline should not report face detection result. + - name: FaceDetectModeSimple + value: 1 + description: | + Pipeline should at least report faces boundary rectangles and + confidence score for each of them. + + - FaceDetectFaceRectangles: + type: Rectangle + description: | + Boundary rectangle of the detected faces. + + size: [n] + + - FaceDetectFaceScores: + type: uint8_t + description: | + Confidence score of each of the detected faces by face detector. + The range of score is [0, 100], but usually those with low confidence + scores will not be included. + Currently identical to ANDROID_STATISTICS_FACE_SCORES. + + size: [n] + + - FaceDetectFaceLandmark: + type: Point + description: | + Array of human face landmark coordinates in format: + [..., left_eye_i, right_eye_i, mouth_i, left_eye_i+1, ...], + with i = index of face. + + size: [n] + - HdrMode: type: int32_t description: | diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 11d35321c..ce73ae9d7 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -61,6 +61,7 @@ static constexpr size_t ControlValueSize[] = { [ControlTypeString] = sizeof(char), [ControlTypeRectangle] = sizeof(Rectangle), [ControlTypeSize] = sizeof(Size), + [ControlTypePoint] = sizeof(Point), }; } /* namespace */ @@ -255,6 +256,11 @@ std::string ControlValue::toString() const str += value->toString(); break; } + case ControlTypePoint: { + const Point *value = reinterpret_cast(data); + str += value->toString(); + break; + } case ControlTypeNone: case ControlTypeString: break;