TYImageProc.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**@file TYImageProc.h
  2. * @breif Image post-process API
  3. * @copyright Copyright(C)2016-2018 Percipio All Rights Reserved
  4. **/
  5. #ifndef TY_IMAGE_PROC_H_
  6. #define TY_IMAGE_PROC_H_
  7. #include "TYApi.h"
  8. #include "TYCoordinateMapper.h"
  9. #include "TyIsp.h"
  10. /// @brief Image processing acceleration switch
  11. /// @param [in] en Enable image process acceleration switch
  12. TY_CAPI TYImageProcesAcceEnable(bool en);
  13. /// @brief Do image undistortion, only support TY_PIXEL_FORMAT_MONO ,TY_PIXEL_FORMAT_RGB,TY_PIXEL_FORMAT_BGR.
  14. /// @param [in] srcCalibInfo Image calibration data.
  15. /// @param [in] srcImage Source image.
  16. /// @param [in] cameraNewIntrinsic Expected new image intrinsic, will use srcCalibInfo for new image intrinsic if set to NULL.
  17. /// @param [out] dstImage Output image.
  18. /// @retval TY_STATUS_OK Succeed.
  19. /// @retval TY_STATUS_NULL_POINTER Any srcCalibInfo, srcImage, dstImage, srcImage->buffer, dstImage->buffer is NULL.
  20. /// @retval TY_STATUS_INVALID_PARAMETER Invalid srcImage->width, srcImage->height, dstImage->width, dstImage->height or unsupported pixel format.
  21. TY_CAPI TYUndistortImage (const TY_CAMERA_CALIB_INFO *srcCalibInfo
  22. , const TY_IMAGE_DATA *srcImage
  23. , const TY_CAMERA_INTRINSIC *cameraNewIntrinsic
  24. , TY_IMAGE_DATA *dstImage
  25. );
  26. // -----------------------------------------------------------
  27. struct DepthSpeckleFilterParameters {
  28. int max_speckle_size; // blob size smaller than this will be removed
  29. int max_speckle_diff; // Maximum difference between neighbor disparity pixels
  30. };
  31. ///<default parameter value definition
  32. #define DepthSpeckleFilterParameters_Initializer {150, 64}
  33. /// @brief Remove speckles on depth image.
  34. /// @param [in,out] depthImage Depth image to be processed.
  35. /// @param [in] param Algorithm parameters.
  36. /// @retval TY_STATUS_OK Succeed.
  37. /// @retval TY_STATUS_NULL_POINTER Any depth, param or depth->buffer is NULL.
  38. /// @retval TY_STATUS_INVALID_PARAMETER param->max_speckle_size <= 0 or param->max_speckle_diff <= 0
  39. TY_CAPI TYDepthSpeckleFilter (TY_IMAGE_DATA* depthImage
  40. , const DepthSpeckleFilterParameters* param
  41. );
  42. // -----------------------------------------------------------
  43. struct DepthEnhenceParameters{
  44. float sigma_s; ///< filter param on space
  45. float sigma_r; ///< filter param on range
  46. int outlier_win_sz; ///< outlier filter windows ize
  47. float outlier_rate;
  48. };
  49. ///<default parameter value definition
  50. #define DepthEnhenceParameters_Initializer {10, 20, 10, 0.1f}
  51. /// @brief Remove speckles on depth image.
  52. /// @param [in] depthImage Pointer to depth image array.
  53. /// @param [in] imageNum Depth image array size.
  54. /// @param [in,out] guide Guide image.
  55. /// @param [out] output Output depth image.
  56. /// @param [in] param Algorithm parameters.
  57. /// @retval TY_STATUS_OK Succeed.
  58. /// @retval TY_STATUS_NULL_POINTER Any depthImage, param, output or output->buffer is NULL.
  59. /// @retval TY_STATUS_INVALID_PARAMETER imageNum >= 5 or imageNum <= 0, or any image invalid
  60. /// @retval TY_STATUS_OUT_OF_MEMORY Output image not suitable.
  61. TY_CAPI TYDepthEnhenceFilter (const TY_IMAGE_DATA* depthImages
  62. , int imageNum
  63. , TY_IMAGE_DATA *guide
  64. , TY_IMAGE_DATA *output
  65. , const DepthEnhenceParameters* param
  66. );
  67. #endif