20 #include "cmw_camera.h"
25 #if defined(USE_IMX335_SENSOR)
26 #define GAMMA_CONVERSION 0
27 #elif defined(USE_VD66GY_SENSOR)
28 #define GAMMA_CONVERSION 0
29 #elif defined(USE_VD55G1_SENSOR)
30 #define GAMMA_CONVERSION 0
34 #define CAMERA_WIDTH 0
35 #define CAMERA_HEIGHT 0
42 CMW_Aspect_Ratio_Mode_t aspect_ratio;
43 CMW_DCMIPP_Conf_t dcmipp_conf = {0};
48 aspect_ratio = CMW_Aspect_ratio_crop;
52 aspect_ratio = CMW_Aspect_ratio_fit;
56 aspect_ratio = CMW_Aspect_ratio_fullscreen;
65 lcd_bg_width = (((camConf->width*lcd_bg_height)/camConf->height) - ((camConf->width*lcd_bg_height)/camConf->height) % 16);
70 *bg_width = lcd_bg_width;
71 *bg_height = lcd_bg_height;
73 dcmipp_conf.output_width = lcd_bg_width;
74 dcmipp_conf.output_height = lcd_bg_height;
75 dcmipp_conf.output_format = DCMIPP_PIXEL_PACKER_FORMAT_RGB565_1;
76 dcmipp_conf.output_bpp = 2;
77 dcmipp_conf.mode = aspect_ratio;
78 dcmipp_conf.enable_gamma_conversion = GAMMA_CONVERSION;
80 ret = CMW_CAMERA_SetPipeConfig(DCMIPP_PIPE1, &dcmipp_conf, &pitch);
81 assert(ret == HAL_OK);
82 assert(dcmipp_conf.output_width * dcmipp_conf.output_bpp == pitch);
87 CMW_Aspect_Ratio_Mode_t aspect_ratio;
88 CMW_DCMIPP_Conf_t dcmipp_conf;
93 aspect_ratio = CMW_Aspect_ratio_crop;
97 aspect_ratio = CMW_Aspect_ratio_fit;
101 aspect_ratio = CMW_Aspect_ratio_fit;
104 dcmipp_conf.output_width =
NN_WIDTH;
106 dcmipp_conf.output_format = DCMIPP_PIXEL_PACKER_FORMAT_RGB888_YUV444_1;
107 dcmipp_conf.output_bpp =
NN_BPP;
108 dcmipp_conf.mode = aspect_ratio;
110 dcmipp_conf.enable_gamma_conversion = GAMMA_CONVERSION;
111 ret = CMW_CAMERA_SetPipeConfig(DCMIPP_PIPE2, &dcmipp_conf, pitch);
112 assert(ret == HAL_OK);
124 CMW_CameraInit_t cam_conf;
129 cam_conf.pixel_format = 0;
130 cam_conf.anti_flicker = 0;
133 ret = CMW_CAMERA_Init(&cam_conf);
134 assert(ret == CMW_ERROR_NONE);
142 ret = CMW_CAMERA_DeInit();
143 assert(ret == CMW_ERROR_NONE);
149 ret = CMW_CAMERA_Start(DCMIPP_PIPE1, display_pipe_dst, cam_mode);
150 assert(ret == CMW_ERROR_NONE);
157 ret = CMW_CAMERA_Start(DCMIPP_PIPE2, nn_pipe_dst, cam_mode);
158 assert(ret == CMW_ERROR_NONE);
164 ret = CMW_CAMERA_Suspend(DCMIPP_PIPE1);
165 assert(ret == CMW_ERROR_NONE);
170 int ret = CMW_ERROR_NONE;
171 ret = CMW_CAMERA_Run();
172 assert(ret == CMW_ERROR_NONE);
int CMW_CAMERA_PIPE_FrameEventCallback(uint32_t pipe)
Frame event callback.
void CameraPipeline_Init(uint32_t *lcd_bg_width, uint32_t *lcd_bg_height, uint32_t *pitch_nn)
Init the camera and the 2 DCMIPP pipes.
void CameraPipeline_NNPipe_Start(uint8_t *nn_pipe_dst, uint32_t cam_mode)
void CameraPipeline_DisplayPipe_Stop()
void CameraPipeline_IspUpdate(void)
int32_t cameraFrameReceived
Camera frame ready flag.
void CameraPipeline_DeInit(void)
static void DCMIPP_PipeInitNn(uint32_t *pitch)
static void DCMIPP_PipeInitDisplay(CMW_CameraInit_t *camConf, uint32_t *bg_width, uint32_t *bg_height)
void CameraPipeline_DisplayPipe_Start(uint8_t *display_pipe_dst, uint32_t cam_mode)
Central configuration header for the STM32N6570-DK pose estimation firmware application.
#define NN_BPP
Bytes per pixel of the NN input tensor.
#define COLOR_MODE
Active color format: RGB.
#define NN_HEIGHT
Neural network input image height in pixels.
#define CAMERA_FLIP
Camera mirror/flip mode — no transformation applied.
#define ASPECT_RATIO_MODE
Active aspect ratio mode for this deployment.
#define NN_WIDTH
Neural network input image width in pixels.
#define ASPECT_RATIO_CROP
Crop mode — both camera pipes are cropped to the NN input aspect ratio.
#define ASPECT_RATIO_FIT
Fit mode — both pipes are resized to the NN input aspect ratio.
#define ASPECT_RATIO_FULLSCREEN
Fullscreen mode — camera image is resized to fill the entire LCD.