hal_ni_adaptiveThreshold returns CV_HAL_ERROR_NOT_IMPLEMENTED

Hello and thanks for supporting this fabulous library.

I have integrated OpenCV in a C++ project (as a static library). I want to use the cv::adaptiveThreshold method, but I see that the implementation is empty

inline int hal_ni_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) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }

I guess I am not correctly building the Visual Studio solution using CMake.
Any ideas?

Thank you very much!

tell us more, please,
version ? did you build it locally ? how exactly did you β€œintegrate” it ?

does it throw an exeption ?

Hi berak! Thank you very much for the fast response.

I detail all the steps:

  • Clone the OpenCV repository from Github

  • Using CMake to generate Visual Studio 2019 solution with default options except for:

    • [ ] BUILD_ITT (Disabled)
    • [ ] BUILD_IPP (Disabled)
    • [ ] BUILD_SHARED_LIB (Disabled) Generate static libraries
  • Here the CMake report and test images: https://nappgui.com/shared/OpenCV_issue.zip

  • The project compile correctly.

  • I have link the β€˜opencv_core455.lib’ and β€˜opencv_imageproc455.lib’ to my project.

  • I have use β€˜cv::threshold’ with β€˜THRESH_BINARY’ and β€˜THRESH_OTSU’ and they work fine.

  • BUT when I use β€˜cv::adaptiveThreshold’ the the results are very poor.

    • blockSize = 5, delta = 2, type = ADAPTIVE_THRESH_GAUSSIAN_C
  • The original and computed images are in previous .zip file. I have use my own implementation of adaptativeThreshold for compare results.

  • No exception has been throw.

  • I have debug the program and step into β€˜cv::adaptiveThreshold’

  • The line:

CALL_HAL(adaptiveThreshold, cv_hal_adaptiveThreshold, src.data, src.step, dst.data, dst.step, src.cols, src.rows,
             maxValue, method, type, blockSize, delta);

is calling to a default ΒΏempty? implementation of threshold algorithm

inline int hal_ni_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) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }

//! @cond IGNORED
#define cv_hal_adaptiveThreshold  hal_ni_adaptiveThreshold
//! @endcond

Perhaps I need another extra flag when a compile OpenCV from sources.

Thank you very much for any kind of help!
Regards

1 Like

yea, just did the same, and, to my surprise -
no exception, (code just continues below that).

i think, if there would be anything in custom_hal.hpp,it would have overwritten this (but there isn’t (yet?))

however - apart from the useless indirection, and the confusion from this,
not much harm done, imo.

no, this looks like it is meant to be the way it is (nothing to do on your side)