1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #29062 from Tiansuanyu:project4_wangzixi

hal/riscv-rvv: implement spatialGradient
This commit is contained in:
Alexander Smorkalov
2026-05-27 17:36:15 +03:00
committed by GitHub
4 changed files with 295 additions and 0 deletions
+24
View File
@@ -1409,6 +1409,30 @@ inline int hal_ni_laplacian(const uchar* src_data, size_t src_step, uchar* dst_d
#define cv_hal_laplacian hal_ni_laplacian
//! @endcond
/**
@brief Compute spatial gradient (Sobel X and Y simultaneously).
@param src_data Source image data (8-bit single channel)
@param src_step Source image step
@param dx_data Destination X-gradient data (16-bit signed)
@param dx_step Destination X-gradient step
@param dy_data Destination Y-gradient data (16-bit signed)
@param dy_step Destination Y-gradient step
@param width Image width
@param height Image height
@param ksize Kernel size (must be 3)
@param border_type Border type (BORDER_DEFAULT or BORDER_REPLICATE)
*/
inline int hal_ni_spatialGradient(const uchar* src_data, size_t src_step,
short* dx_data, size_t dx_step,
short* dy_data, size_t dy_step,
int width, int height,
int ksize, int border_type)
{ return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @cond IGNORED
#define cv_hal_spatialGradient hal_ni_spatialGradient
//! @endcond
/**
@brief Perform Gaussian Blur and downsampling for input tile.
@param depth Depths of source and destination image
+7
View File
@@ -113,6 +113,13 @@ void spatialGradient( InputArray _src, OutputArray _dx, OutputArray _dy,
// TODO: Allow for other kernel sizes
CV_Assert(ksize == 3);
CALL_HAL(spatialGradient, cv_hal_spatialGradient,
src.data, src.step,
dx.ptr<short>(), dx.step,
dy.ptr<short>(), dy.step,
src.cols, src.rows,
ksize, borderType);
// Get dimensions
const int H = src.rows,
W = src.cols;