diff options
Diffstat (limited to 'color_pipe.h')
-rw-r--r-- | color_pipe.h | 98 |
1 files changed, 71 insertions, 27 deletions
diff --git a/color_pipe.h b/color_pipe.h index 2833d0f..b4c50da 100644 --- a/color_pipe.h +++ b/color_pipe.h @@ -2,9 +2,7 @@ * @file color_pipe.h * @brief Color Processing Pipeline Definitions * @author Patrick Roth - roth@stettbacher.ch -* @version 1.0 -* @date 2016-03-01 -* @copyright 2012-2016 Stettbacher Signal Processing AG +* @copyright Stettbacher Signal Processing AG * * @remarks * @@ -36,6 +34,15 @@ /** + * Coordinate definition. + */ +struct coord_t { + int x; ///< x-coordinate of calibrated pixel + int y; ///< y-coordinate of calibrated pixel +}; + + +/** * demosaicing algorithm definition */ enum bayer_alg_t { @@ -55,7 +62,7 @@ struct debayer_data_t { enum enumDataFormat_t format; ///< data format of input image enum enumBayerPattern_t start_pattern; ///< first pixel starts with this bayer pattern enum bayer_alg_t alg; ///< debayer algorithm type - enum bayer_alg_t alg_new; ///< this debayer algorithm type is changed by API call (use double buffering concept) + enum bayer_alg_t alg_new; ///< this debayer algorithm type is changed by API call (use double buffering) }; @@ -71,9 +78,9 @@ struct awb_data_t { int width; ///< image width in number of pixels int16_t *img_yuv; ///< Image buffer holding YUV image. This buffer must be allocated externly. float gray_threshold; ///< gray value threshold - float gray_threshold_new; ///< this gray value threshold is changed by API call (use double buffering concept) + float gray_threshold_new; ///< this gray value threshold is changed by API call (use double buffering) float ctrl_k; ///< controller gain - float ctrl_k_new; ///< this controller gain is changed by API call (use double buffering concept) + float ctrl_k_new; ///< this controller gain is changed by API call (use double buffering) float gain_red; ///< red color gain float gain_blue; ///< blue color gain }; @@ -131,19 +138,6 @@ enum o3000_lenses_t { /** - * Lense undistortion coordinate definition. - * This coordinate pair defines the undistorted pixel location. - * - * NOTE The pixel location may lay between a pixel pair. Therefore this coordinates are - * scaled by a defined factor defined at @ref cam_calib_data_t. - */ -struct lense_undistort_coord_t { - int coord_x; ///< x-coordinate of calibrated pixel - int coord_y; ///< y-coordinate of calibrated pixel -}; - - -/** * camera calibration structure * * The total width @ref tot_width and height @ref tot_height define the image size take during calibration processs. @@ -164,10 +158,23 @@ struct cam_calib_data_t { struct dist_coeff_t dist_coeff; ///< distortion coefficients struct camera_matrix_t camera_matrix; ///< camera matrix enum o3000_lenses_t lense; ///< lense type - enum o3000_lenses_t lense_new; ///< lense type is changed by API call (use double buffering concept) + enum o3000_lenses_t lense_new; ///< lense type is changed by API call (use double buffering) int undistort_map_init; ///< flag indicating if lens undistortion map is initialized - struct lense_undistort_coord_t *calib_map; ///< Lense undistortion map. This buffer must be allocated externly. - int calib_map_scale_fact; ///< Bit shifts applied on undistortion map. + + /** + * Lense undistortion map. + * A coordinate pair defines the undistorted pixel location. It may be shifted (see @ref calib_map_scale_fact). + * + * This buffer must be allocated externly. + */ + struct coord_t *calib_map; + + /** + * Bit shift applied on undistortion map @ref calib_map. + * The pixel location may lay between a pixel pair. Therefore the coordinates defined at the undistortion map + * @ref calib_map are (scaled) shifted by this factor. + */ + int calib_map_scale_fact; }; @@ -218,7 +225,7 @@ struct color_calib_data_t { int height; ///< image height in number of pixels float a[3][3]; ///< 3x3 color correction matrix enum ccm_preset_t ccm; ///< color correction matrix type loaded - enum ccm_preset_t ccm_new; ///< this color correction matrix type is changed by API call (use double buffering concept) + enum ccm_preset_t ccm_new; ///< this color correction matrix type is changed by API call (use double buffering) }; @@ -244,11 +251,11 @@ struct sharp_data_t { int height; ///< image height in number of pixels int16_t *img_yuv; ///< YUV image buffer. This buffer must be allocated externly. float sharp_factor; ///< Sharpening factor: As higher as stronger sharpening is done. - float sharp_factor_new; ///< this sharpening factor is changed by API call (use double buffering concept) + float sharp_factor_new; ///< this sharpening factor is changed by API call (use double buffering) enum sharp_alg_t sharp_alg; ///< sharpening algorithm type - enum sharp_alg_t sharp_alg_new; ///< this algorithm type is changed by API call (use double buffering concept) + enum sharp_alg_t sharp_alg_new; ///< this algorithm type is changed by API call (use double buffering) float local_sens; ///< Sensitivity setting of local sharpening algorithm in per cent. 100 % means everything is sharpened like the global algorithm does - float local_sens_new; ///< this sensitivity setting is changed by API call (use double buffering concept) + float local_sens_new; ///< this sensitivity setting is changed by API call (use double buffering) int16_t *img_yuv_sharp; ///< YUV image buffer holding sharpened Y-channel. This buffer must be allocated externly. int16_t *img_sobel; ///< Sobel image in YUV color space used by local sharpening algorithm. This buffer must be allocated externly. int16_t *img_gauss; ///< Gaussian low-pass filtered image in YUV color space used by local sharpening algorithm. This buffer must be allocated externly. @@ -268,7 +275,7 @@ struct gamma_data_t { int width; ///< image width in number of pixels int height; ///< image height in number of pixels float gamma; ///< gamma coefficient - float gamma_new; ///< this gamma coefficient is changed by API call (use double buffering concept) + float gamma_new; ///< this gamma coefficient is changed by API call (use double buffering) int gamma_table_bitdepth; ///< gamma table is initialized with this bit-depth float gamma_table_init; ///< gamma table is initialized with this coefficient int *gamma_table; ///< Lookup table containg gamma corrected value. This buffer must be allocated externly. @@ -276,6 +283,41 @@ struct gamma_data_t { /** + * Isosceles trapezoid correction definition + */ +struct trapcorr_data_t { + int enable; ///< flag to enable this algorithm + void *img_out; ///< Isosceles corrected output image. This buffer must be allocated externly. + void *img_in; ///< Input image. + int is_color; ///< Not 0 if it's a color image + int bit_channel; ///< Bits per color channel. + int width; ///< image width in number of pixels + int height; ///< image height in number of pixels + float wv; ///< vertical correction weight in per cent (NOTE not implemented yet!) + float wh; ///< horizontal correction weight in per cent + float wv_new; ///< this vertical correction weight in per cent is changed by API call (use double buffering) (NOTE not implemented yet!) + float wh_new; ///< this horizontal correction weight in per cent is changed by API call (use double buffering) + + int map_init; ///< flag indicating perspective correction map is initialized + + /** + * perspective correction map + * A coordinate pair defines the pixel location to be corrected. It may be shifted (see @ref map_scale_fact). + * + * This buffer must be allocated externly. + */ + struct coord_t *map; + + /** + * Bit shift applied on correction map @ref map. + * The pixel location may lay between a pixel pair. Therefore the coordinates defined at the correction map + * @ref map are (scaled) shifted by this factor. + */ + int map_scale_fact; +}; + + +/** * Color pipe definition structure holding all memory data from different pipeline * stages. This structure and image buffers are allocated dynamically. */ @@ -293,6 +335,7 @@ struct color_pipe_t { struct color_calib_data_t color_calib_data; ///< color calibration data used for color corretion struct sharp_data_t sharp_data; ///< image sharpening data struct gamma_data_t gamma_data; ///< gamma correction data + struct trapcorr_data_t trapcorr_data; ///< isosceles trapezoid correction data }; @@ -312,6 +355,7 @@ void __stdcall color_pipe_stageconf_cam_calib(struct color_pipe_t *color_pipe, i void __stdcall color_pipe_stageconf_color_calib(struct color_pipe_t *color_pipe, int enable, enum ccm_preset_t ccm_preset); void __stdcall color_pipe_stageconf_sharp(struct color_pipe_t *color_pipe, int enable, float factor, enum sharp_alg_t alg, float sens); void __stdcall color_pipe_stageconf_gamma(struct color_pipe_t *color_pipe, int enable, float gamma); +void __stdcall color_pipe_stageconf_trapcorr(struct color_pipe_t *color_pipe, int enable, float wv, float wh); #if defined(__cplusplus) || defined(c_plusplus) } // extern "C" |