fastcv_hal_imgproc.hpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /*
  2. * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. #ifndef OPENCV_FASTCV_HAL_IMGPROC_HPP_INCLUDED
  6. #define OPENCV_FASTCV_HAL_IMGPROC_HPP_INCLUDED
  7. #include <opencv2/core/base.hpp>
  8. #undef cv_hal_medianBlur
  9. #define cv_hal_medianBlur fastcv_hal_medianBlur
  10. #undef cv_hal_sobel
  11. #define cv_hal_sobel fastcv_hal_sobel
  12. #undef cv_hal_boxFilter
  13. #define cv_hal_boxFilter fastcv_hal_boxFilter
  14. #undef cv_hal_adaptiveThreshold
  15. #define cv_hal_adaptiveThreshold fastcv_hal_adaptiveThreshold
  16. #undef cv_hal_gaussianBlurBinomial
  17. #define cv_hal_gaussianBlurBinomial fastcv_hal_gaussianBlurBinomial
  18. #undef cv_hal_warpPerspective
  19. #define cv_hal_warpPerspective fastcv_hal_warpPerspective
  20. #undef cv_hal_pyrdown
  21. #define cv_hal_pyrdown fastcv_hal_pyrdown
  22. #undef cv_hal_cvtBGRtoHSV
  23. #define cv_hal_cvtBGRtoHSV fastcv_hal_cvtBGRtoHSV
  24. #undef cv_hal_cvtBGRtoYUVApprox
  25. #define cv_hal_cvtBGRtoYUVApprox fastcv_hal_cvtBGRtoYUVApprox
  26. #undef cv_hal_canny
  27. #define cv_hal_canny fastcv_hal_canny
  28. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  29. /// @brief Calculate medianBlur filter
  30. /// @param src_data Source image data
  31. /// @param src_step Source image step
  32. /// @param dst_data Destination image data
  33. /// @param dst_step Destination image step
  34. /// @param width Source image width
  35. /// @param height Source image height
  36. /// @param depth Depths of source and destination image
  37. /// @param cn Number of channels
  38. /// @param ksize Size of kernel
  39. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  40. int fastcv_hal_medianBlur(
  41. const uchar* src_data,
  42. size_t src_step,
  43. uchar* dst_data,
  44. size_t dst_step,
  45. int width,
  46. int height,
  47. int depth,
  48. int cn,
  49. int ksize);
  50. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  51. /// @brief Computes Sobel derivatives
  52. ///
  53. /// @param src_data Source image data
  54. /// @param src_step Source image step
  55. /// @param dst_data Destination image data
  56. /// @param dst_step Destination image step
  57. /// @param width Source image width
  58. /// @param height Source image height
  59. /// @param src_depth Depth of source image
  60. /// @param dst_depth Depths of destination image
  61. /// @param cn Number of channels
  62. /// @param margin_left Left margins for source image
  63. /// @param margin_top Top margins for source image
  64. /// @param margin_right Right margins for source image
  65. /// @param margin_bottom Bottom margins for source image
  66. /// @param dx orders of the derivative x
  67. /// @param dy orders of the derivative y
  68. /// @param ksize Size of kernel
  69. /// @param scale Scale factor for the computed derivative values
  70. /// @param delta Delta value that is added to the results prior to storing them in dst
  71. /// @param border_type Border type
  72. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  73. int fastcv_hal_sobel(
  74. const uchar* src_data,
  75. size_t src_step,
  76. uchar* dst_data,
  77. size_t dst_step,
  78. int width,
  79. int height,
  80. int src_depth,
  81. int dst_depth,
  82. int cn,
  83. int margin_left,
  84. int margin_top,
  85. int margin_right,
  86. int margin_bottom,
  87. int dx,
  88. int dy,
  89. int ksize,
  90. double scale,
  91. double delta,
  92. int border_type);
  93. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  94. int fastcv_hal_boxFilter(
  95. const uchar* src_data,
  96. size_t src_step,
  97. uchar* dst_data,
  98. size_t dst_step,
  99. int width,
  100. int height,
  101. int src_depth,
  102. int dst_depth,
  103. int cn,
  104. int margin_left,
  105. int margin_top,
  106. int margin_right,
  107. int margin_bottom,
  108. size_t ksize_width,
  109. size_t ksize_height,
  110. int anchor_x,
  111. int anchor_y,
  112. bool normalize,
  113. int border_type);
  114. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  115. int fastcv_hal_adaptiveThreshold(
  116. const uchar* src_data,
  117. size_t src_step,
  118. uchar* dst_data,
  119. size_t dst_step,
  120. int width,
  121. int height,
  122. double maxValue,
  123. int adaptiveMethod,
  124. int thresholdType,
  125. int blockSize,
  126. double C);
  127. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  128. /// @brief Blurs an image using a Gaussian filter.
  129. /// @param src_data Source image data
  130. /// @param src_step Source image step
  131. /// @param dst_data Destination image data
  132. /// @param dst_step Destination image step
  133. /// @param width Source image width
  134. /// @param height Source image height
  135. /// @param depth Depth of source and destination image
  136. /// @param cn Number of channels
  137. /// @param margin_left Left margins for source image
  138. /// @param margin_top Top margins for source image
  139. /// @param margin_right Right margins for source image
  140. /// @param margin_bottom Bottom margins for source image
  141. /// @param ksize Kernel size
  142. /// @param border_type Border type
  143. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  144. int fastcv_hal_gaussianBlurBinomial(
  145. const uchar* src_data,
  146. size_t src_step,
  147. uchar* dst_data,
  148. size_t dst_step,
  149. int width,
  150. int height,
  151. int depth,
  152. int cn,
  153. size_t margin_left,
  154. size_t margin_top,
  155. size_t margin_right,
  156. size_t margin_bottom,
  157. size_t ksize,
  158. int border_type);
  159. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  160. /// @brief Applies a perspective transformation to an image.
  161. ///
  162. /// @param src_type Source and destination image type
  163. /// @param src_data Source image data
  164. /// @param src_step Source image step
  165. /// @param src_width Source image width
  166. /// @param src_height Source image height
  167. /// @param dst_data Destination image data
  168. /// @param dst_step Destination image step
  169. /// @param dst_width Destination image width
  170. /// @param dst_height Destination image height
  171. /// @param M 3x3 matrix with transform coefficients
  172. /// @param interpolation Interpolation mode (CV_HAL_INTER_NEAREST, ...)
  173. /// @param border_type Border processing mode (CV_HAL_BORDER_REFLECT, ...)
  174. /// @param border_value Values to use for CV_HAL_BORDER_CONSTANT mode
  175. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  176. int fastcv_hal_warpPerspective(
  177. int src_type,
  178. const uchar* src_data,
  179. size_t src_step,
  180. int src_width,
  181. int src_height,
  182. uchar* dst_data,
  183. size_t dst_step,
  184. int dst_width,
  185. int dst_height,
  186. const double M[9],
  187. int interpolation,
  188. int border_type,
  189. const double border_value[4]);
  190. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  191. int fastcv_hal_pyrdown(
  192. const uchar* src_data,
  193. size_t src_step,
  194. int src_width,
  195. int src_height,
  196. uchar* dst_data,
  197. size_t dst_step,
  198. int dst_width,
  199. int dst_height,
  200. int depth,
  201. int cn,
  202. int border_type);
  203. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  204. int fastcv_hal_cvtBGRtoHSV(
  205. const uchar * src_data,
  206. size_t src_step,
  207. uchar * dst_data,
  208. size_t dst_step,
  209. int width,
  210. int height,
  211. int depth,
  212. int scn,
  213. bool swapBlue,
  214. bool isFullRange,
  215. bool isHSV);
  216. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  217. int fastcv_hal_cvtBGRtoYUVApprox(
  218. const uchar * src_data,
  219. size_t src_step,
  220. uchar * dst_data,
  221. size_t dst_step,
  222. int width,
  223. int height,
  224. int depth,
  225. int scn,
  226. bool swapBlue,
  227. bool isCbCr);
  228. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  229. /// @brief Canny edge detector
  230. /// @param src_data Source image data
  231. /// @param src_step Source image step
  232. /// @param dst_data Destination image data
  233. /// @param dst_step Destination image step
  234. /// @param width Source image width
  235. /// @param height Source image height
  236. /// @param cn Number of channels
  237. /// @param lowThreshold low thresholds value
  238. /// @param highThreshold high thresholds value
  239. /// @param ksize Kernel size for Sobel operator.
  240. /// @param L2gradient Flag, indicating use of L2 or L1 norma.
  241. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  242. int fastcv_hal_canny(
  243. const uchar* src_data,
  244. size_t src_step,
  245. uchar* dst_data,
  246. size_t dst_step,
  247. int width,
  248. int height,
  249. int cn,
  250. double lowThreshold,
  251. double highThreshold,
  252. int ksize,
  253. bool L2gradient);
  254. #endif