imgproc.hpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. // This file is part of OpenCV project.
  2. // It is subject to the license terms in the LICENSE file found in the top-level directory
  3. // of this distribution and at http://opencv.org/license.html.
  4. #ifndef OPENCV_RVV_HAL_IMGPROC_HPP
  5. #define OPENCV_RVV_HAL_IMGPROC_HPP
  6. struct cvhalFilter2D;
  7. namespace cv { namespace rvv_hal { namespace imgproc {
  8. #if CV_HAL_RVV_1P0_ENABLED
  9. /* ############ imageMoments ############ */
  10. int imageMoments(const uchar* src_data, size_t src_step, int src_type,
  11. int width, int height, bool binary, double m[10]);
  12. #undef cv_hal_imageMoments
  13. #define cv_hal_imageMoments cv::rvv_hal::imgproc::imageMoments
  14. /* ############ filter ############ */
  15. int filterInit(cvhalFilter2D** context, uchar* kernel_data, size_t kernel_step, int kernel_type, int kernel_width, int kernel_height, int /*max_width*/, int /*max_height*/, int src_type, int dst_type, int borderType, double delta, int anchor_x, int anchor_y, bool /*allowSubmatrix*/, bool /*allowInplace*/);
  16. int filter(cvhalFilter2D* context, uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int full_width, int full_height, int offset_x, int offset_y);
  17. int filterFree(cvhalFilter2D* context);
  18. #undef cv_hal_filterInit
  19. #define cv_hal_filterInit cv::rvv_hal::imgproc::filterInit
  20. #undef cv_hal_filter
  21. #define cv_hal_filter cv::rvv_hal::imgproc::filter
  22. #undef cv_hal_filterFree
  23. #define cv_hal_filterFree cv::rvv_hal::imgproc::filterFree
  24. /* ############ sepFilter ############ */
  25. int sepFilterInit(cvhalFilter2D **context, int src_type, int dst_type, int kernel_type, uchar* kernelx_data, int kernelx_length, uchar* kernely_data, int kernely_length, int anchor_x, int anchor_y, double delta, int borderType);
  26. int sepFilter(cvhalFilter2D *context, uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int full_width, int full_height, int offset_x, int offset_y);
  27. int sepFilterFree(cvhalFilter2D* context);
  28. #undef cv_hal_sepFilterInit
  29. #define cv_hal_sepFilterInit cv::rvv_hal::imgproc::sepFilterInit
  30. #undef cv_hal_sepFilter
  31. #define cv_hal_sepFilter cv::rvv_hal::imgproc::sepFilter
  32. #undef cv_hal_sepFilterFree
  33. #define cv_hal_sepFilterFree cv::rvv_hal::imgproc::sepFilterFree
  34. /* ############ morph ############ */
  35. int morphInit(cvhalFilter2D** context, int operation, int src_type, int dst_type, int /*max_width*/, int /*max_height*/, int kernel_type, uchar* kernel_data, size_t kernel_step, int kernel_width, int kernel_height, int anchor_x, int anchor_y, int borderType, const double borderValue[4], int iterations, bool /*allowSubmatrix*/, bool /*allowInplace*/);
  36. int morph(cvhalFilter2D* context, uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int src_full_width, int src_full_height, int src_roi_x, int src_roi_y, int /*dst_full_width*/, int /*dst_full_height*/, int /*dst_roi_x*/, int /*dst_roi_y*/);
  37. int morphFree(cvhalFilter2D* context);
  38. #undef cv_hal_morphInit
  39. #undef cv_hal_morph
  40. #undef cv_hal_morphFree
  41. #define cv_hal_morphInit cv::rvv_hal::imgproc::morphInit
  42. #define cv_hal_morph cv::rvv_hal::imgproc::morph
  43. #define cv_hal_morphFree cv::rvv_hal::imgproc::morphFree
  44. /* ############ gaussianBlur ############ */
  45. int gaussianBlurBinomial(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int depth, int cn, size_t margin_left, size_t margin_top, size_t margin_right, size_t margin_bottom, size_t ksize, int border_type);
  46. #undef cv_hal_gaussianBlurBinomial
  47. #define cv_hal_gaussianBlurBinomial cv::rvv_hal::imgproc::gaussianBlurBinomial
  48. /* ############ medianBlur ############ */
  49. int medianBlur(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int depth, int cn, int ksize);
  50. #undef cv_hal_medianBlur
  51. #define cv_hal_medianBlur cv::rvv_hal::imgproc::medianBlur
  52. /* ############ boxFilter ############ */
  53. int boxFilter(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int src_depth, int dst_depth, int cn, int margin_left, int margin_top, int margin_right, int margin_bottom, size_t ksize_width, size_t ksize_height, int anchor_x, int anchor_y, bool normalize, int border_type);
  54. #undef cv_hal_boxFilter
  55. #define cv_hal_boxFilter cv::rvv_hal::imgproc::boxFilter
  56. /* ############ bilateralFilter ############ */
  57. int bilateralFilter(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step,
  58. int width, int height, int depth, int cn, int d, double sigma_color,
  59. double sigma_space, int border_type);
  60. #undef cv_hal_bilateralFilter
  61. #define cv_hal_bilateralFilter cv::rvv_hal::imgproc::bilateralFilter
  62. /* ############ pyramid ############ */
  63. int pyrDown(const uchar* src_data, size_t src_step, int src_width, int src_height, uchar* dst_data, size_t dst_step, int dst_width, int dst_height, int depth, int cn, int border_type);
  64. int pyrUp(const uchar* src_data, size_t src_step, int src_width, int src_height, uchar* dst_data, size_t dst_step, int dst_width, int dst_height, int depth, int cn, int border_type);
  65. #undef cv_hal_pyrdown
  66. #define cv_hal_pyrdown cv::rvv_hal::imgproc::pyrDown
  67. #undef cv_hal_pyrup
  68. #define cv_hal_pyrup cv::rvv_hal::imgproc::pyrUp
  69. /* ############ cvtColor ############ */
  70. int cvtBGRtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int scn, int dcn, bool swapBlue);
  71. int cvtGraytoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int dcn);
  72. int cvtBGRtoGray(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int scn, bool swapBlue);
  73. int cvtBGR5x5toBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int dcn, bool swapBlue, int greenBits);
  74. int cvtBGRtoBGR5x5(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int scn, bool swapBlue, int greenBits);
  75. int cvtBGR5x5toGray(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int greenBits);
  76. int cvtGraytoBGR5x5(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int greenBits);
  77. int cvtYUVtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int dcn, bool swapBlue, bool isCbCr);
  78. int cvtBGRtoYUV(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int scn, bool swapBlue, bool isCbCr);
  79. int cvtOnePlaneYUVtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx, int yIdx);
  80. int cvtTwoPlaneYUVtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx);
  81. int cvtThreePlaneYUVtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int dst_width, int dst_height, int dcn, bool swapBlue, int uIdx);
  82. int cvtOnePlaneBGRtoYUV(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int scn, bool swapBlue, int uIdx, int yIdx);
  83. int cvtBGRtoTwoPlaneYUV(const uchar * src_data, size_t src_step, uchar * y_data, size_t y_step, uchar * uv_data, size_t uv_step, int width, int height, int scn, bool swapBlue, int uIdx);
  84. int cvtBGRtoThreePlaneYUV(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int scn, bool swapBlue, int uIdx);
  85. int cvtHSVtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int dcn, bool swapBlue, bool isFullRange, bool isHSV);
  86. int cvtBGRtoHSV(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int scn, bool swapBlue, bool isFullRange, bool isHSV);
  87. int cvtXYZtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int dcn, bool swapBlue);
  88. int cvtBGRtoXYZ(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int scn, bool swapBlue);
  89. int cvtLabtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int dcn, bool swapBlue, bool isLab, bool srgb);
  90. int cvtBGRtoLab(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int scn, bool swapBlue, bool isLab, bool srgb);
  91. #undef cv_hal_cvtBGRtoBGR
  92. #define cv_hal_cvtBGRtoBGR cv::rvv_hal::imgproc::cvtBGRtoBGR
  93. #undef cv_hal_cvtGraytoBGR
  94. #define cv_hal_cvtGraytoBGR cv::rvv_hal::imgproc::cvtGraytoBGR
  95. #undef cv_hal_cvtBGRtoGray
  96. #define cv_hal_cvtBGRtoGray cv::rvv_hal::imgproc::cvtBGRtoGray
  97. #undef cv_hal_cvtBGR5x5toBGR
  98. #define cv_hal_cvtBGR5x5toBGR cv::rvv_hal::imgproc::cvtBGR5x5toBGR
  99. #undef cv_hal_cvtBGRtoBGR5x5
  100. #define cv_hal_cvtBGRtoBGR5x5 cv::rvv_hal::imgproc::cvtBGRtoBGR5x5
  101. #undef cv_hal_cvtBGR5x5toGray
  102. #define cv_hal_cvtBGR5x5toGray cv::rvv_hal::imgproc::cvtBGR5x5toGray
  103. #undef cv_hal_cvtGraytoBGR5x5
  104. #define cv_hal_cvtGraytoBGR5x5 cv::rvv_hal::imgproc::cvtGraytoBGR5x5
  105. #undef cv_hal_cvtYUVtoBGR
  106. #define cv_hal_cvtYUVtoBGR cv::rvv_hal::imgproc::cvtYUVtoBGR
  107. #undef cv_hal_cvtBGRtoYUV
  108. #define cv_hal_cvtBGRtoYUV cv::rvv_hal::imgproc::cvtBGRtoYUV
  109. #undef cv_hal_cvtOnePlaneYUVtoBGR
  110. #define cv_hal_cvtOnePlaneYUVtoBGR cv::rvv_hal::imgproc::cvtOnePlaneYUVtoBGR
  111. #undef cv_hal_cvtTwoPlaneYUVtoBGR
  112. #define cv_hal_cvtTwoPlaneYUVtoBGR cv::rvv_hal::imgproc::cvtTwoPlaneYUVtoBGR
  113. #undef cv_hal_cvtThreePlaneYUVtoBGR
  114. #define cv_hal_cvtThreePlaneYUVtoBGR cv::rvv_hal::imgproc::cvtThreePlaneYUVtoBGR
  115. #undef cv_hal_cvtOnePlaneBGRtoYUV
  116. #define cv_hal_cvtOnePlaneBGRtoYUV cv::rvv_hal::imgproc::cvtOnePlaneBGRtoYUV
  117. #undef cv_hal_cvtBGRtoTwoPlaneYUV
  118. #define cv_hal_cvtBGRtoTwoPlaneYUV cv::rvv_hal::imgproc::cvtBGRtoTwoPlaneYUV
  119. #undef cv_hal_cvtBGRtoThreePlaneYUV
  120. #define cv_hal_cvtBGRtoThreePlaneYUV cv::rvv_hal::imgproc::cvtBGRtoThreePlaneYUV
  121. #undef cv_hal_cvtHSVtoBGR
  122. #define cv_hal_cvtHSVtoBGR cv::rvv_hal::imgproc::cvtHSVtoBGR
  123. #undef cv_hal_cvtBGRtoHSV
  124. #define cv_hal_cvtBGRtoHSV cv::rvv_hal::imgproc::cvtBGRtoHSV
  125. #undef cv_hal_cvtXYZtoBGR
  126. #define cv_hal_cvtXYZtoBGR cv::rvv_hal::imgproc::cvtXYZtoBGR
  127. #undef cv_hal_cvtBGRtoXYZ
  128. #define cv_hal_cvtBGRtoXYZ cv::rvv_hal::imgproc::cvtBGRtoXYZ
  129. #undef cv_hal_cvtLabtoBGR
  130. #define cv_hal_cvtLabtoBGR cv::rvv_hal::imgproc::cvtLabtoBGR
  131. #undef cv_hal_cvtBGRtoLab
  132. #define cv_hal_cvtBGRtoLab cv::rvv_hal::imgproc::cvtBGRtoLab
  133. /* ############ warp ############ */
  134. int remap32f(int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height,
  135. uchar *dst_data, size_t dst_step, int dst_width, int dst_height,
  136. float* mapx, size_t mapx_step, float* mapy, size_t mapy_step,
  137. int interpolation, int border_type, const double border_value[4]);
  138. int remap32fc2(int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height,
  139. uchar *dst_data, size_t dst_step, int dst_width, int dst_height,
  140. float* map, size_t map_step, int interpolation, int border_type, const double border_value[4]);
  141. int remap16s(int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height,
  142. uchar *dst_data, size_t dst_step, int dst_width, int dst_height,
  143. short* mapx, size_t mapx_step, ushort* mapy, size_t mapy_step,
  144. int interpolation, int border_type, const double border_value[4]);
  145. #undef cv_hal_remap32f
  146. #define cv_hal_remap32f cv::rvv_hal::imgproc::remap32f
  147. #undef cv_hal_remap32fc2
  148. #define cv_hal_remap32fc2 cv::rvv_hal::imgproc::remap32fc2
  149. #undef cv_hal_remap16s
  150. #define cv_hal_remap16s cv::rvv_hal::imgproc::remap16s
  151. int warpAffine(int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height, uchar *dst_data, size_t dst_step, int dst_width, int dst_height, const double M[6], int interpolation, int borderType, const double borderValue[4]);
  152. int warpPerspective(int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height, uchar *dst_data, size_t dst_step, int dst_width, int dst_height, const double M[9], int interpolation, int borderType, const double borderValue[4]);
  153. #undef cv_hal_warpAffine
  154. #define cv_hal_warpAffine cv::rvv_hal::imgproc::warpAffine
  155. #undef cv_hal_warpPerspective
  156. #define cv_hal_warpPerspective cv::rvv_hal::imgproc::warpPerspective
  157. /* ############ threshold ############ */
  158. int threshold(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int depth, int cn, double thresh, double maxValue, int thresholdType);
  159. int threshold_otsu(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, int depth, double maxValue, int thresholdType, double* thresh);
  160. int adaptiveThreshold(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height, double maxValue, int adaptiveMethod, int thresholdType, int blockSize, double C);
  161. // disabled since UI is fast enough, only called in threshold_otsu
  162. // #undef cv_hal_threshold
  163. // #define cv_hal_threshold cv::rvv_hal::imgproc::threshold
  164. #undef cv_hal_threshold_otsu
  165. #define cv_hal_threshold_otsu cv::rvv_hal::imgproc::threshold_otsu
  166. #undef cv_hal_adaptiveThreshold
  167. #define cv_hal_adaptiveThreshold cv::rvv_hal::imgproc::adaptiveThreshold
  168. /* ############ histogram ############ */
  169. int equalize_hist(const uchar* src_data, size_t src_step, uchar* dst_data, size_t dst_step, int width, int height);
  170. #undef cv_hal_equalize_hist
  171. #define cv_hal_equalize_hist cv::rvv_hal::imgproc::equalize_hist
  172. int calc_hist(const uchar* src_data, size_t src_step, int src_type, int src_width, int src_height, float* hist_data, int hist_size, const float** ranges, bool uniform, bool accumulate);
  173. #undef cv_hal_calcHist
  174. #define cv_hal_calcHist cv::rvv_hal::imgproc::calc_hist
  175. /* ############ resize ############ */
  176. int resize(int src_type, const uchar *src_data, size_t src_step, int src_width, int src_height, uchar *dst_data, size_t dst_step, int dst_width, int dst_height, double inv_scale_x, double inv_scale_y, int interpolation);
  177. #undef cv_hal_resize
  178. #define cv_hal_resize cv::rvv_hal::imgproc::resize
  179. /* ############ resize ############ */
  180. int integral(int depth, int sdepth, int sqdepth,
  181. const uchar* src_data, size_t src_step,
  182. uchar* sum_data, size_t sum_step,
  183. uchar* sqsum_data, size_t sqsum_step,
  184. uchar* tilted_data, [[maybe_unused]] size_t tilted_step,
  185. int width, int height, int cn);
  186. // Diasbled due to accuracy issue.
  187. // Details see https://github.com/opencv/opencv/issues/27407.
  188. //#undef cv_hal_integral
  189. //#define cv_hal_integral cv::rvv_hal::imgproc::integral
  190. /* ############ scharr ############ */
  191. int scharr(const uint8_t *src_data, size_t src_step, uint8_t *dst_data, size_t dst_step, int width, int height, int src_depth, int dst_depth, int cn, int margin_left, int margin_top, int margin_right, int margin_bottom, int dx, int dy, double scale, double delta, int border_type);
  192. #undef cv_hal_scharr
  193. #define cv_hal_scharr cv::rvv_hal::imgproc::scharr
  194. /* ############ sobel ############ */
  195. int sobel(const uint8_t *src_data, size_t src_step, uint8_t *dst_data, size_t dst_step, int width, int height, int src_depth, int dst_depth, int cn, int margin_left, int margin_top, int margin_right, int margin_bottom, int dx, int dy, int ksize, double scale, double delta, int border_type);
  196. #undef cv_hal_sobel
  197. #define cv_hal_sobel cv::rvv_hal::imgproc::sobel
  198. /* ############ canny ############ */
  199. int canny(const uint8_t *src_data, size_t src_step,
  200. uint8_t *dst_data, size_t dst_step,
  201. int width, int height, int cn,
  202. double low_thresh, double high_thresh,
  203. int ksize, bool L2gradient);
  204. #undef cv_hal_canny
  205. #define cv_hal_canny cv::rvv_hal::imgproc::canny
  206. #endif // CV_HAL_RVV_1P0_ENABLED
  207. #if CV_HAL_RVV_071_ENABLED
  208. int cvtBGRtoBGR(const uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, int depth, int scn, int dcn, bool swapBlue);
  209. #undef cv_hal_cvtBGRtoBGR
  210. #define cv_hal_cvtBGRtoBGR cv::rvv_hal::imgproc::cvtBGRtoBGR
  211. #endif // CV_HAL_RVV_071_ENABLED
  212. }}} // cv::rvv_hal::imgproc
  213. #endif // OPENCV_RVV_HAL_IMGPROC_HPP