mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge pull request #27033 from CodeLinaro:xuezha_3rdPost
Fix assert failure in Sobel test when enable FastCV #27033 ### 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 - [ ] 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:
+3
-3
@@ -247,15 +247,15 @@ int fastcv_hal_cvtBGRtoYUVApprox(
|
||||
/// @param width Source image width
|
||||
/// @param height Source image height
|
||||
/// @param cn Number of channels
|
||||
/// @param lowThreshold low hresholds value
|
||||
/// @param lowThreshold low thresholds value
|
||||
/// @param highThreshold high thresholds value
|
||||
/// @param ksize Kernel size for Sobel operator.
|
||||
/// @param L2gradient Flag, indicating use of L2 or L1 norma.
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int fastcv_hal_canny(
|
||||
const uchar* src_data,
|
||||
const uchar* src_data,
|
||||
size_t src_step,
|
||||
uchar* dst_data,
|
||||
uchar* dst_data,
|
||||
size_t dst_step,
|
||||
int width,
|
||||
int height,
|
||||
|
||||
+10
-9
@@ -75,13 +75,13 @@ class FcvSobelLoop_Invoker : public cv::ParallelLoopBody
|
||||
// Need additional lines to be border.
|
||||
if(range.start > 0)
|
||||
{
|
||||
topLines += halfKernelSize;
|
||||
paddedHeight += halfKernelSize;
|
||||
topLines += MIN(range.start, halfKernelSize);
|
||||
paddedHeight += MIN(range.start, halfKernelSize);
|
||||
}
|
||||
|
||||
if(range.end < height)
|
||||
{
|
||||
paddedHeight += halfKernelSize;
|
||||
paddedHeight += MIN(height-range.end, halfKernelSize);
|
||||
}
|
||||
|
||||
cv::Mat srcPadded = src(cv::Rect(0, range.start-topLines, width, paddedHeight));
|
||||
@@ -305,8 +305,9 @@ int fastcv_hal_sobel(
|
||||
else
|
||||
{
|
||||
int nThreads = cv::getNumThreads();
|
||||
int nStripes = nThreads > 1 ? 3*nThreads : 1;
|
||||
|
||||
// In each stripe, the height should be equal or larger than ksize.
|
||||
// Use 3*nThreads stripes to avoid too many threads.
|
||||
int nStripes = nThreads > 1 ? MIN(height / (int)ksize, 3 * nThreads) : 1;
|
||||
cv::parallel_for_(cv::Range(0, height), FcvSobelLoop_Invoker(src, dst, dx, dy, ksize, fcvBorder, 0), nStripes);
|
||||
}
|
||||
|
||||
@@ -1017,10 +1018,10 @@ int fastcv_hal_canny(
|
||||
|
||||
if (lowThreshold > highThreshold)
|
||||
CV_HAL_RETURN_NOT_IMPLEMENTED("lowThreshold is greater then highThreshold");
|
||||
|
||||
const double epsilon = 1e-9;
|
||||
|
||||
if (std::abs(lowThreshold - std::round(lowThreshold)) > epsilon || std::abs(highThreshold - std::round(highThreshold)) > epsilon)
|
||||
|
||||
const double epsilon = 1e-9;
|
||||
|
||||
if (std::abs(lowThreshold - std::round(lowThreshold)) > epsilon || std::abs(highThreshold - std::round(highThreshold)) > epsilon)
|
||||
CV_HAL_RETURN_NOT_IMPLEMENTED("threshold with decimal values not supported");
|
||||
|
||||
INITIALIZATION_CHECK;
|
||||
|
||||
Reference in New Issue
Block a user