samples: video: capture: Add hflip option

Add an option to mirror the video image horizontally. This helps
to avoid doing so at the post-processing step by using additional
HW such as PxP on i.MX RT platforms.

Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
This commit is contained in:
Phi Bang Nguyen 2024-12-06 21:12:10 +01:00 committed by Benjamin Cabé
commit 8939a6cc7e
2 changed files with 11 additions and 2 deletions

View file

@ -22,6 +22,11 @@ config VIDEO_PIXEL_FORMAT
help
Pixel format of the video frame. If not set, the default pixel format is used.
config VIDEO_CTRL_HFLIP
bool "Mirror the video frame horizontally"
help
If set, mirror the video frame horizontally
endmenu
source "Kconfig.zephyr"

View file

@ -9,13 +9,12 @@
#include <zephyr/drivers/display.h>
#include <zephyr/drivers/video.h>
#include <zephyr/drivers/video-controls.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(main);
#ifdef CONFIG_TEST
#include <zephyr/drivers/video-controls.h>
#include "check_test_pattern.h"
#define LOG_LEVEL LOG_LEVEL_DBG
@ -179,6 +178,11 @@ int main(void)
fie.index++;
}
/* Set controls */
if (IS_ENABLED(CONFIG_VIDEO_CTRL_HFLIP)) {
video_set_ctrl(video_dev, VIDEO_CID_HFLIP, (void *)1);
}
#ifdef CONFIG_TEST
video_set_ctrl(video_dev, VIDEO_CID_TEST_PATTERN, (void *)1);
#endif