1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #23098 from savuor:nanMask

finiteMask() and doubles for patchNaNs() #23098

Related to #22826
Connected PR in extra: [#1037@extra](https://github.com/opencv/opencv_extra/pull/1037)

### TODOs:
- [ ] Vectorize `finiteMask()` for 64FC3 and 64FC4

### Changes

This PR:
* adds a new function `finiteMask()`
* extends `patchNaNs()` by CV_64F support
* moves `patchNaNs()` and `finiteMask()` to a separate file

**NOTE:** now the function is called `finiteMask()` as discussed with the OpenCV core team

### 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
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Rostislav Vasilikhin
2023-11-09 08:32:47 +01:00
committed by GitHub
parent 34f34f6227
commit 53aad98a1a
15 changed files with 1190 additions and 138 deletions
+11 -2
View File
@@ -1697,12 +1697,21 @@ elements.
CV_EXPORTS_W bool checkRange(InputArray a, bool quiet = true, CV_OUT Point* pos = 0,
double minVal = -DBL_MAX, double maxVal = DBL_MAX);
/** @brief converts NaNs to the given number
@param a input/output matrix (CV_32F type).
/** @brief Replaces NaNs by given number
@param a input/output matrix (CV_32F or CV_64F type)
@param val value to convert the NaNs
*/
CV_EXPORTS_W void patchNaNs(InputOutputArray a, double val = 0);
/** @brief Generates a mask of finite float values, i.e. not NaNs nor Infs.
An element is set to to 255 (all 1-bits) if all channels are finite.
@param src Input matrix, should contain float or double elements of 1 to 4 channels
@param mask Output matrix of the same size as input of type CV_8UC1
*/
CV_EXPORTS_W void finiteMask(InputArray src, OutputArray mask);
/** @brief Performs generalized matrix multiplication.
The function cv::gemm performs generalized matrix multiplication similar to the