mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge pull request #28887 from milllemonman:4.x
hal/riscv-rvv: implement laplacian #28887 OpenCV Extra: https://github.com/opencv/opencv_extra/pull/1353 An implementation of laplacian for riscv-rvv hal Added benchmark in perf_laplacian.cpp The performance is evaluated on K1 by running ./opencv_perf_imgproc --gtest_filter="Perf_Laplacian*" Results are attached in the figure below. CV_8U fast path supports ksize=3 with BORDER_CONSTANT/BORDER_REPLICATE; unsupported combinations fall back to default implementation. See performance results bellow. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -750,6 +750,22 @@ void cv::Laplacian( InputArray _src, OutputArray _dst, int ddepth, int ksize,
|
||||
|
||||
if( ksize == 1 || ksize == 3 )
|
||||
{
|
||||
Mat src = _src.getMat();
|
||||
Mat dst = _dst.getMat();
|
||||
|
||||
Point ofs;
|
||||
Size wsz(src.cols, src.rows);
|
||||
if(!(borderType & BORDER_ISOLATED))
|
||||
src.locateROI(wsz, ofs);
|
||||
|
||||
CALL_HAL(laplacian, cv_hal_laplacian,
|
||||
src.ptr(), src.step,
|
||||
dst.ptr(), dst.step,
|
||||
src.cols, src.rows,
|
||||
sdepth, ddepth, cn,
|
||||
ksize, borderType & ~BORDER_ISOLATED,
|
||||
(uint8_t)0);
|
||||
|
||||
filter2D( _src, _dst, ddepth, kernel, Point(-1, -1), delta, borderType );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1388,6 +1388,27 @@ inline int hal_ni_scharr(const uchar* src_data, size_t src_step, uchar* dst_data
|
||||
#define cv_hal_scharr hal_ni_scharr
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@brief Computes Laplacian filter
|
||||
@param src_data Source image data
|
||||
@param src_step Source image step
|
||||
@param dst_data Destination image data
|
||||
@param dst_step Destination image step
|
||||
@param width Source image width
|
||||
@param height Source image height
|
||||
@param src_depth Depth of source image
|
||||
@param dst_depth Depth of destination image
|
||||
@param cn Number of channels
|
||||
@param ksize Kernel size (1, 3, or 5)
|
||||
@param border_type Border type
|
||||
@param border_value Border value for CONSTANT
|
||||
*/
|
||||
inline int hal_ni_laplacian(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 ksize, int border_type, uchar border_value) { return CV_HAL_ERROR_NOT_IMPLEMENTED;}
|
||||
|
||||
//! @cond IGNORED
|
||||
#define cv_hal_laplacian hal_ni_laplacian
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@brief Perform Gaussian Blur and downsampling for input tile.
|
||||
@param depth Depths of source and destination image
|
||||
|
||||
Reference in New Issue
Block a user