Skip to content

Commit 8939a6c

Browse files
ngphibangkartben
authored andcommitted
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>
1 parent fefc285 commit 8939a6c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

samples/drivers/video/capture/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ config VIDEO_PIXEL_FORMAT
2222
help
2323
Pixel format of the video frame. If not set, the default pixel format is used.
2424

25+
config VIDEO_CTRL_HFLIP
26+
bool "Mirror the video frame horizontally"
27+
help
28+
If set, mirror the video frame horizontally
29+
2530
endmenu
2631

2732
source "Kconfig.zephyr"

samples/drivers/video/capture/src/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99

1010
#include <zephyr/drivers/display.h>
1111
#include <zephyr/drivers/video.h>
12+
#include <zephyr/drivers/video-controls.h>
1213

1314
#include <zephyr/logging/log.h>
1415
LOG_MODULE_REGISTER(main);
1516

1617
#ifdef CONFIG_TEST
17-
#include <zephyr/drivers/video-controls.h>
18-
1918
#include "check_test_pattern.h"
2019

2120
#define LOG_LEVEL LOG_LEVEL_DBG
@@ -179,6 +178,11 @@ int main(void)
179178
fie.index++;
180179
}
181180

181+
/* Set controls */
182+
if (IS_ENABLED(CONFIG_VIDEO_CTRL_HFLIP)) {
183+
video_set_ctrl(video_dev, VIDEO_CID_HFLIP, (void *)1);
184+
}
185+
182186
#ifdef CONFIG_TEST
183187
video_set_ctrl(video_dev, VIDEO_CID_TEST_PATTERN, (void *)1);
184188
#endif

0 commit comments

Comments
 (0)