x-linux-ai: recipes-samples: fix USB camera support
This commit fixes several issues related to the initialization of AI demos when using a USB camera. Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
parent
3b9fc78c8b
commit
4adb7ae271
|
|
@ -1,7 +1,9 @@
|
|||
# Copyright (C) 2024, Digi International Inc.
|
||||
# Copyright (C) 2024,2025, Digi International Inc.
|
||||
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://patches/0001-config_board-add-support-to-STM32MP255-processor.patch \
|
||||
file://patches/0002-config_board-fix-support-for-web-camera-with-STM32MP.patch \
|
||||
file://patches/0003-setup_camera_main_isp-fix-support-for-web-camera.patch \
|
||||
"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
From: Arturo Buzarra <arturo.buzarra@digi.com>
|
||||
Date: Tue, 21 Jan 2025 12:04:52 +0100
|
||||
Subject: [PATCH] config_board: fix support for web camera with STM32MP255
|
||||
processor
|
||||
|
||||
This commit disables the dual camera pipeline support for USB cameras, as it is
|
||||
exclusive to cameras using the DCMIPP peripheral.
|
||||
|
||||
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
|
||||
---
|
||||
.../files/resources-files/config_board.sh | 27 +++++++++++++++++++
|
||||
1 file changed, 27 insertions(+)
|
||||
|
||||
diff --git a/resources-files/config_board.sh b/resources-files/config_board.sh
|
||||
index a623086..e7e8b00 100644
|
||||
--- a/resources-files/config_board.sh
|
||||
+++ b/resources-files/config_board.sh
|
||||
@@ -15,10 +15,28 @@ STM32MP157="stm32mp157"
|
||||
STM32MP157FEV1="stm32mp157f-ev1st"
|
||||
STM32MP255="stm32mp255"
|
||||
STM32MP257="stm32mp257"
|
||||
STM32MP257FEV1="stm32mp257f-ev1st"
|
||||
|
||||
+function is_dcmipp_present() {
|
||||
+ DCMIPP_SENSOR="NOTFOUND"
|
||||
+ # ov5640 or imx335 camera can be present on csi connector
|
||||
+ for video in $(find /sys/class/video4linux -name "video*" -type l);
|
||||
+ do
|
||||
+ if [ "$(cat $video/name)" = "dcmipp_main_capture" ]; then
|
||||
+ for sub in $(find /sys/class/video4linux -name "v4l-subdev*" -type l);
|
||||
+ do
|
||||
+ subdev_name=$(tr -d '\0' < $sub/name | awk '{print $1}')
|
||||
+ if [ "$subdev_name" = "ov5640" ] || [ "$subdev_name" = "imx335" ]; then
|
||||
+ DCMIPP_SENSOR=$subdev_name
|
||||
+ break;
|
||||
+ fi
|
||||
+ done
|
||||
+ fi
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
if [[ "$FRAMEWORK" == "nbg" ]]; then
|
||||
NN_EXT=".nb"
|
||||
elif [[ "$FRAMEWORK" == "tflite" ]]; then
|
||||
NN_EXT=".tflite"
|
||||
elif [[ "$FRAMEWORK" == "onnx" ]]; then
|
||||
@@ -107,10 +125,19 @@ if [[ "$COMPATIBLE" == *"$STM32MP255"* ]]; then
|
||||
OBJ_DETEC_MODEL="coco_ssd_mobilenet/ssd_mobilenet_v2_fpnlite_10_256_int8$NN_EXT"
|
||||
OBJ_DETEC_MODEL_LABEL="coco_ssd_mobilenet/labels_coco_dataset_80"
|
||||
fi
|
||||
OBJ_DETECT_DATA="coco_ssd_mobilenet/testdata/"
|
||||
OPTIONS="--dual_camera_pipeline"
|
||||
+
|
||||
+ is_dcmipp_present
|
||||
+ if [ "$DCMIPP_SENSOR" != "NOTFOUND" ]; then
|
||||
+ # DCMIPP camera
|
||||
+ OPTIONS="--dual_camera_pipeline"
|
||||
+ else
|
||||
+ # Web camera
|
||||
+ OPTIONS=""
|
||||
+ fi
|
||||
fi
|
||||
|
||||
if [[ "$COMPATIBLE" == *"$STM32MP257"* ]]; then
|
||||
SEMANTIC_SEGMENTATION_MODEL="deeplabv3/deeplabv3_257_int8_per_tensor$NN_EXT"
|
||||
SEMANTIC_SEGMENTATION_LABEL="deeplabv3/labels_pascalvoc"
|
||||
--
|
||||
2.34.1
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
From: Arturo Buzarra <arturo.buzarra@digi.com>
|
||||
Date: Tue, 21 Jan 2025 12:08:51 +0100
|
||||
Subject: [PATCH] setup_camera_main_isp: fix support for web camera
|
||||
|
||||
This commit fixes the logic for detecting internal DCMIPP camera devices and
|
||||
disables any image post-processing when using USB cameras.
|
||||
|
||||
Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
|
||||
---
|
||||
.../resources/files/resources-files/setup_camera_main_isp.sh | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/resources-files/setup_camera_main_isp.sh b/resources-files/setup_camera_main_isp.sh
|
||||
index b52ffa2..444bf37 100644
|
||||
--- a/resources-files/setup_camera_main_isp.sh
|
||||
+++ b/resources-files/setup_camera_main_isp.sh
|
||||
@@ -56,11 +56,11 @@ function is_dcmipp_present() {
|
||||
|
||||
function get_webcam_device() {
|
||||
found="NOTFOUND"
|
||||
for video in $(find /sys/class/video4linux -name "video*" -type l | sort);
|
||||
do
|
||||
- if [ "$(cat $video/name)" = "dcmipp_main_capture" ] || [ "$(cat $video/name)" = "st,stm32mp25-vdec-dec" ] || [ "$(cat $video/name)" = "st,stm32mp25-venc-enc" ] || [ "$(cat $video/name)" = "dcmipp_dump_capture" ] || [ "$(cat $video/name)" = "dcmipp_aux_capture" ] || [ "$(cat $video/name)" = "dcmipp_main_isp_stat_capture" ] ; then
|
||||
+ if [ "$(cat $video/name)" = "dcmipp_main_capture" ] || [ "$(cat $video/name)" = "st,stm32mp25-vdec-dec" ] || [ "$(cat $video/name)" = "st,stm32mp25-venc-enc" ] || [ "$(cat $video/name)" = "dcmipp_dump_capture" ] || [ "$(cat $video/name)" = "dcmipp_aux_capture" ] || [ "$(cat $video/name)" = "dcmipp_main_isp_stat_capture" ] || [ "$(cat $video/name)" = "dcmipp_main_isp_params_output" ] ; then
|
||||
found="FOUND"
|
||||
else
|
||||
V4L_DEVICE="$(basename $video)"
|
||||
break;
|
||||
fi
|
||||
@@ -220,6 +220,7 @@ else
|
||||
V4L2_CAPS="video/x-raw, width=$WIDTH, height=$HEIGHT"
|
||||
V4L_OPT="io-mode=4"
|
||||
v4l2-ctl --set-parm=20
|
||||
echo "V4L_DEVICE_PREV="$V4L_DEVICE
|
||||
echo "V4L2_CAPS_PREV="$V4L2_CAPS
|
||||
+ echo "MAIN_POSTPROC= "
|
||||
fi
|
||||
--
|
||||
2.34.1
|
||||
Loading…
Reference in New Issue