Commit Graph

940 Commits

Author SHA1 Message Date
Dmitry Kurtaev
c230841105
Merge pull request #26446 from dkurt:file_storage_empty_and_1d_mat
* Change style of empty and 1d Mat in FileStorage

* Remove misleading 1d Mat test
2024-11-12 17:51:10 +03:00
Dmitry Kurtaev
37c2af63f0
Merge pull request #26434 from dkurt:dk/int64_file_storage_4.x
int64 data type support for FileStorage. 1d and empty Mat with exact dimensions #26434

### Pull Request Readiness Checklist

Port of https://github.com/opencv/opencv/pull/26399 to 4.x branch

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
2024-11-11 14:13:33 +03:00
Wanli
687e37e6a8
Merge pull request #25892 from WanliZhong:v_sincos
Add support for v_sin and v_cos (Sine and Cosine) #25892

This PR aims to implement `v_sincos(v_float16 x)`, `v_sincos(v_float32 x)` and `v_sincos(v_float64 x)`. 
Merged after https://github.com/opencv/opencv/pull/25891 and https://github.com/opencv/opencv/pull/26023

**NOTE:** 
Also, the patch changes already added `v_exp`, `v_log` and `v_erf` to pass parameters by reference instead of by value, to match API of other universal intrinsics.

TODO:
- [x] double and half float precision
- [x] tests for them
- [x] doc to explain the implementation

### 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
2024-10-10 13:25:12 +03:00
Kumataro
40428d919d
Merge pull request #26259 from Kumataro:fix26258
core: C-API cleanup: RNG algorithms in core(4.x) #26259

- replace CV_RAND_UNI and NORMAL to cv::RNG::UNIFORM and cv::RNG::NORMAL.

### 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
2024-10-08 15:55:00 +03:00
Wanli
783fe72756
Resolve Compilation Error for v_func Function in SIMD Emulator (#25891)
* use 2 parms for now to identify the error

* Revert "use 2 parms for now to identify the error"

This reverts commit 86faf993a7.

* replace += with =

* add v_log ref

* refactor intrin_math code

* Add include guard to `intrin_math.hpp` to prevent multiple inclusions

* rename VX to V; make fp64 impl in neon be optional

* add v_setall, v_setzero for all backends; rewrite the intrin_math

* fix error on rvv_scalable

* let v_erf use v_exp_default_32f function

* 1. replaced 'v_setzero(VecType dummy)' with 'v_setzero_<VecType>()'
2. replaced 'v_setall(LaneType x, VecType dummy)' with 'v_setall_<VecType>(LaneType x)'
3. added tests for the new v_setzero_<> and v_setall_<>.

* gcc does not seem to like static_assert in functions even when they are not used

* trying to fix compile errors in Debug mode on Linux

---------

Co-authored-by: Vadim Pisarevsky <vadim.pisarevsky@gmail.com>
2024-10-02 21:28:48 +03:00
Rostislav Vasilikhin
8725a7e21c Mixed arithmetics tests: multichannel 2024-09-09 13:54:00 +02:00
Kumataro
a3bdbf5553
Merge pull request #26022 from Kumataro:fix26016
Imgproc: use double to determine whether the corners points are within src #26022

close #26016
Related https://github.com/opencv/opencv_contrib/pull/3778

### 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
2024-08-23 12:35:13 +03:00
Rostislav Vasilikhin
7fe36a3cb2 lock rounding mode for parallel test run 2024-08-21 09:02:02 +03:00
Alexander Smorkalov
ea2a3cb264
Merge pull request #25643 from cpoerschke:issue-25635-find-existing-file-tests
replace lena.jpg in find-existing-file tests
2024-08-05 15:28:16 +03:00
Alexander Smorkalov
a15cd4b63d Set and check allocator pointer for all cv::Mat instances. 2024-08-05 10:07:14 +03:00
Kumataro
be3c519956 core: FileStorage: detect invalid attribute value 2024-07-26 05:55:00 +09:00
Alexander Smorkalov
04f9e3cd4f Restored removed test_round_pair_f64 test afetr PR 24941. 2024-07-15 12:59:12 +03:00
Yuantao Feng
d30b9450c1
Merge pull request #25872 from fengyuentau:core/v_erf
core: add v_erf #25872

This patch adds v_erf, which is needed by https://github.com/opencv/opencv/pull/25147.

### 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
2024-07-05 15:46:01 +03:00
Wanli
bef6c110a4
Merge pull request #25781 from WanliZhong:v_log
Add support for v_log (Natural Logarithm) #25781

This PR aims to implement `v_log(v_float16 x)`, `v_log(v_float32 x)` and `v_log(v_float64 x)`. 
Merged after https://github.com/opencv/opencv/pull/24941

TODO:
- [x] double and half float precision
- [x] tests for them
- [x] doc to explain the implementation

### 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
2024-07-03 10:59:44 +03:00
Wanli
6e1864e3fc
Merge pull request #24941 from WanliZhong:v_exp
Add support for v_exp (exponential) #24941

This PR aims to implement `v_exp(v_float16 x)`, `v_exp(v_float32 x)` and `v_exp(v_float64 x)`.

### 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
2024-07-02 12:32:49 +03:00
Simon Kämpe
7ef42d7706
Merge pull request #25751 from simonkampe:fix-eigen-rowmajor
Add missing cv2eigen overload #25751

Fixes #16606

Add overloads to cv2eigen to handle eigen matrices of type
Eigen::Matrix<Tp_, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>

### 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
- [ ] 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
2024-06-20 20:05:06 +03:00
Alexander Smorkalov
a102b24285 Added LUT for FP16 and accuracy test. 2024-06-19 16:16:11 +03:00
Maksim Shabunin
ef3303716e test: use cv::theRNG instead of own generator 2024-06-07 13:36:11 +03:00
Rostislav Vasilikhin
a7e53aa184
Merge pull request #25671 from savuor:rv/arithm_extend_tests
Tests added for mixed type arithmetic operations #25671

### Changes
* added accuracy tests for mixed type arithmetic operations
    _Note: div-by-zero values are removed from checking since the result is implementation-defined in common case_
* added perf tests for the same cases
* fixed a typo in `getMulExtTab()` function that lead to dead code

### 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
2024-06-02 14:28:06 +03:00
Kumataro
1bd5ca1ebe
Merge pull request #25686 from Kumataro:fix25674
Suppress build warnings for GCC14 #25686

Close #25674

### 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
- [ ] 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
2024-06-02 14:14:04 +03:00
Rostislav Vasilikhin
b267f1791c
Merge pull request #25633 from savuor:rv/rotate_tests
Tests for cv::rotate() added #25633

fixes #25449

### 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
2024-05-25 11:23:31 +03:00
Christine Poerschke
8b2783e9ff replace lena.jpg in find-existing-file tests 2024-05-25 08:53:33 +01:00
HAN Liutong
e52540162f
Merge pull request #25586 from hanliutong:rvv-64f
Fix v_round and enable unit tests for scalable universal intrinsic 64F type. #25586

This may be a legacy issue from the previous PR #24325. I don't quite remember why the float 64 part of the unit test was not enabled at that time.

Whatever, this patch enables the unit tests for scalable 64F type , and makes the necessary modifications to the RVV backend to make the tests pass.

This patch is compiled by GCC 14 and LLVM 17 &18, and tested on QEMU and k230.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [ ] I agree to contribute to the project under Apache 2 License.
- [ ] 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
2024-05-21 14:10:19 +03:00
Alexander Smorkalov
1f1ba7e402
Merge pull request #25563 from asmorkalov:as/HAL_min_max_idx
Transform offset to indeces for MatND in minMaxIdx HAL #25563

Address comments in https://github.com/opencv/opencv/pull/25553

### 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
- [ ] 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
2024-05-08 18:57:02 +03:00
Kumataro
d22d0bd49c core: persistence: use hfloat instead of float16_t 2024-04-11 05:18:25 +09:00
Kumataro
b14ea19466
Merge pull request #25351 from Kumataro:fix25073_format_g
core: persistence: output reals as human-friendly expression. #25351

Close #25073
Related https://github.com/opencv/opencv/pull/25087

This patch is need to merge same time with https://github.com/opencv/opencv_contrib/pull/3714

### 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
2024-04-10 15:17:15 +03:00
Pierre Chatelier
1a537ab98f
Merge pull request #24893 from chacha21:cart_polar_inplace
Added in-place support for cartToPolar and polarToCart #24893

- a fused hal::cartToPolar[32|64]f() is used instead of sequential hal::magnitude[32|64]f/hal::fastAtan[32|64]f
- ipp_polarToCart is skipped for in-place processing (it seems not to support it correctly)

relates to #24891
### 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.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-03-26 15:38:17 +03:00
Yuantao Feng
3afe8ddaf8
core: Rename cv::float16_t to cv::hfloat (#25217)
* rename cv::float16_t to cv::fp16_t

* add typedef fp16_t float16_t

* remove zero(), bits() from fp16_t class

* fp16_t -> hfloat

* remove cv::float16_t::fromBits; add hfloatFromBits

* undo changes in conv_winograd_f63.simd.hpp and conv_block.simd.hpp

* undo some changes in dnn
2024-03-21 23:44:19 +03:00
Maksim Shabunin
6fc926ea4d Updated RVV intrinsics and test to remove initializer_list 2024-03-13 21:16:58 +03:00
Alexander Smorkalov
daa8f7dfc6 Partially back-port #25075 to 4.x 2024-03-05 12:15:39 +03:00
Sean McBride
e64857c561
Merge pull request #23736 from seanm:c++11-simplifications
Removed all pre-C++11 code, workarounds, and branches #23736

This removes a bunch of pre-C++11 workrarounds that are no longer necessary as C++11 is now required.
It is a nice clean up and simplification.

* No longer unconditionally #include <array> in cvdef.h, include explicitly where needed
* Removed deprecated CV_NODISCARD, already unused in the codebase
* Removed some pre-C++11 workarounds, and simplified some backwards compat defines
* Removed CV_CXX_STD_ARRAY
* Removed CV_CXX_MOVE_SEMANTICS and CV_CXX_MOVE
* Removed all tests of CV_CXX11, now assume it's always true. This allowed removing a lot of dead code.
* Updated some documentation consequently.
* Removed all tests of CV_CXX11, now assume it's always true
* Fixed links.

---------

Co-authored-by: Maksim Shabunin <maksim.shabunin@gmail.com>
Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
2024-01-19 16:53:08 +03:00
Kumataro
dba7186378
Merge pull request #24271 from Kumataro:fix24163
Fix to convert float32 to int32/uint32 with rounding to nearest (ties to even). #24271

Fix https://github.com/opencv/opencv/issues/24163

### 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

(carotene is BSD)
2023-12-25 12:17:17 +03:00
zihaomu
b913e73d04
DNN: add the Winograd fp16 support (#23654)
* add Winograd FP16 implementation

* fixed dispatching of FP16 code paths in dnn; use dynamic dispatcher only when NEON_FP16 is enabled in the build and the feature is present in the host CPU at runtime

* fixed some warnings

* hopefully fixed winograd on x64 (and maybe other platforms)

---------

Co-authored-by: Vadim Pisarevsky <vadim.pisarevsky@gmail.com>
2023-11-20 13:45:37 +03:00
Kumataro
1911c63826
fix: supress GCC13 warnings (#24434)
* fix: supress GCC13 warnings

* fix for review and compile-warning on MacOS
2023-10-26 09:00:58 +03:00
Liutong HAN
a287605c3e Clean up the Universal Intrinsic API. 2023-10-13 19:23:30 +08:00
Sean McBride
5fb3869775
Merge pull request #23109 from seanm:misc-warnings
* Fixed clang -Wnewline-eof warnings
* Fixed all trivial clang -Wextra-semi and -Wc++98-compat-extra-semi warnings
* Removed trailing semi from various macros
* Fixed various -Wunused-macros warnings
* Fixed some trivial -Wdocumentation warnings
* Fixed some -Wdocumentation-deprecated-sync warnings
* Fixed incorrect indentation
* Suppressed some clang warnings in 3rd party code
* Fixed QRCodeEncoder::Params documentation.

---------

Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
2023-10-06 13:33:21 +03:00
Maksim Shabunin
1bccc14e05
Merge pull request #24343 from mshabunin:fix-test-writes
Fix tests writing to current work dir #24343

Several tests were writing files in the current work directory and did not clean up after test. Moved all temporary files to the `/tmp` dir and added a cleanup code.
2023-10-03 16:34:25 +03:00
Dmitry Kurtaev
d78637102c Skip test cases in case of SkipTestException in SetUp 2023-09-20 13:27:06 +03:00
Dmitry Kurtaev
6bc369fc56
Merge pull request #24250 from dkurt:ts_fixture_constructor_skip_2
Skip test on SkipTestException at fixture's constructor (version 2) #24250

### Pull Request Readiness Checklist

Another version of https://github.com/opencv/opencv/pull/24186 (reverted by https://github.com/opencv/opencv/pull/24223). Current implementation cannot handle skip exception at `static void SetUpTestCase` but works on `virtual void SetUp`.

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
2023-09-18 10:23:24 +03:00
Vincent Rabaud
3880d059b3
Merge pull request #24260 from vrabaud:ubsan
Fix undefined behavior arithmetic in copyMakeBorder and adjustROI. #24260

This is due to the undefined: negative int multiplied by size_t pointer increment.

To test, compile with:
```
mkdir build
cd build
cmake ../ -DCMAKE_C_FLAGS_INIT="-fsanitize=undefined" -DCMAKE_CXX_FLAGS_INIT="-fsanitize=undefined" -DCMAKE_C_COMPILER="/usr/bin/clang" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=undefined -lubsan"
```
And run:
```
make -j opencv_test_core && ./bin/opencv_test_core --gtest_filter=*UndefinedBehavior*
```

### 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
2023-09-14 15:16:28 +03:00
Yuriy Chernyshov
8a415c881a Add missing std namespace qualifiers 2023-09-06 13:46:39 +03:00
Alexander Smorkalov
cca4ee2e46 Revert PR 24186 as it force skip tests. 2023-09-05 14:35:37 +03:00
Kumataro
72bb8bb73c core: arm64: v_round() works with round to nearest, ties to even. 2023-09-04 10:27:55 +03:00
Yuantao Feng
a308dfca98
core: add broadcast (#23965)
* add broadcast_to with tests

* change name

* fix test

* fix implicit type conversion

* replace type of shape with InputArray

* add perf test

* add perf tests which takes care of axis

* v2 from ficus expand

* rename to broadcast

* use randu in place of declare

* doc improvement; smaller scale in perf

* capture get_index by reference
2023-08-30 09:53:59 +03:00
Dmitry Kurtaev
588ddf1b18
Merge pull request #24186 from dkurt:ts_fixture_constructor_skip
Skip test on SkipTestException at fixture's constructor

* Skip test on SkipTestException at fixture's constructor

* Add warning supression

* Skip Python tests if no test file found

* Skip instances of test fixture with exception at SetUpTestCase

* Skip test with exception at SetUp method

* Try remove warning disable

* Add CV_NORETURN

* Remove FAIL assertion

* Use findDataFile to throw Skip exception

* Throw exception conditionally
2023-08-25 14:53:34 +03:00
Alexander Smorkalov
bd2695f01b
Merge pull request #23966 from hanliutong:popcount
Add missing ”v_popcount“ for RVV and enable tests.
2023-07-13 12:22:46 +03:00
Liutong HAN
a00818047f Add missing ”v_popcount“ for RVV and enable tests. 2023-07-11 16:10:27 +08:00
Maksim Shabunin
09944a83d9 build: w/a compiler warnings for GCC 11-12 and Clang 13, reduce build output 2023-07-10 11:27:59 +03:00
Alexander Smorkalov
004801f1c5 Merge remote-tracking branch 'origin/3.4' into merge-3.4 2023-06-20 09:56:57 +03:00
Pierre Chatelier
60b806f9b8
Merge pull request #22947 from chacha21:hasNonZero
Added cv::hasNonZero() #22947 

`cv::hasNonZero()` is semantically equivalent to (`cv::countNonZero()>0`) but stops parsing the image when a non-zero value is found, for a performance gain

- [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 pull request might be refused, but I submit it to know if further work is needed or if I just stop working on it.
The idea is only a performance gain vs `countNonZero()>0` at the cost of more code.

Reasons why it might be refused :

- this is just more code
- the execution time is "unfair"/"unpredictable" since it depends on the position of the first non-zero value
- the user must be aware that default search is from first row/col to last row/col and has no way to customize that, even if his use case lets him know where a non zero could be found
- the PR in its current state is using, for the ocl implementation, a mere `countNonZero()>0` ; there is not much sense in trying to break early the ocl kernel call when non-zero is encountered. So the ocl implementation does not bring any improvement.
- there is no IPP function that can help (`countNonZero()` is based in `ippCountInRange`)
- the PR in its current state might be slower than a call to `countNonZero()>0` in some cases (see "challenges" below)

Reasons why it might be accepted :

- the performance gain is huge on average, if we consider that "on average" means "non zero in the middle of the image"
- the "missing" IPP implementation is replaced by an "Open-CV universal intrinsics" implementation
- the PR in its current state is almost always faster than a call to `countNonZero()>0`, is only slightly slower in the worst cases, and not even for all matrices

**Challenges**
The worst case is either an all-zero matrix, or a non-zero at the very last position.  In such a case, the `hasNonZero()` implementation will parse the whole matrix like `countNonZero()` would do. But we expect the performance to be the same in this case. And `ippCountInRange` is hard to beat !
There is also the case of very small matrices (<=32x32...) in 8b, where the SIMD can be hard to feed.

For all cases but the worse, my custom `hasNonZero()` performs better than `ippCountInRange()`
For the worst case, my custom `hasNonZero()` performs better than `ippCountInRange()` *except for large matrices of type CV_32S or CV_64F* (but surprisingly, not CV_32F).
The difference is small, but it exists (and I don't understand why).
For very small CV_8U matrices `ippCountInRange()` seems unbeatable.

Here is the code that I use to check timings

```

  //test cv::hasNonZero() vs (cv::countNonZero()>0) for different matrices sizes, types, strides...
  {
    cv::setRNGSeed(1234);
    const std::vector<cv::Size> sizes = {{32, 32}, {64, 64}, {128, 128}, {320, 240}, {512, 512}, {640, 480}, {1024, 768}, {2048, 2048}, {1031, 1000}};
    const std::vector<int> types = {CV_8U, CV_16U, CV_32S, CV_32F, CV_64F};
    const size_t iterations = 1000;
    for(const cv::Size& size : sizes)
    {
      for(const int type : types)
      {
        for(int c = 0 ; c<2 ; ++c)
        {
          const bool continuous = !c;
          for(int i = 0 ; i<4 ; ++i)
          {
            cv::Mat m = continuous ? cv::Mat::zeros(size, type) : cv::Mat(cv::Mat::zeros(cv::Size(2*size.width, size.height), type), cv::Rect(cv::Point(0, 0), size));
            const bool nz = (i <= 2);
            const unsigned int nzOffsetRange = 10;
            const unsigned int nzOffset = cv::randu<unsigned int>()%nzOffsetRange;
            const cv::Point pos = 
              (i == 0) ? cv::Point(nzOffset, 0) :
              (i == 1) ? cv::Point(size.width/2-nzOffsetRange/2+nzOffset, size.height/2) :
              (i == 2) ? cv::Point(size.width-1-nzOffset, size.height-1) :
              cv::Point(0, 0);
            std::cout << "============================================================" << std::endl;
            std::cout << "size:" << size << "  type:" << type << "  continuous = " << (continuous ? "true" : "false") << "  iterations:" << iterations << "  nz=" << (nz ? "true" : "false");
            std::cout << "  pos=" << ((i == 0) ? "begin" : (i == 1) ? "middle" : (i == 2) ? "end" : "none");
            std::cout << std::endl;
            cv::Mat mask = cv::Mat::zeros(size, CV_8UC1);
            mask.at<unsigned char>(pos) = 0xFF;
            m.setTo(cv::Scalar::all(0));
            m.setTo(cv::Scalar::all(nz ? 1 : 0), mask);
            std::vector<bool> results;
            std::vector<double> timings;

            {
              bool res = false;
              auto ref = cv::getTickCount();
              for(size_t k = 0 ; k<iterations ; ++k)
                res = cv::hasNonZero(m);
              auto now = cv::getTickCount();
              const bool error = (res != nz);
              if (error)
                printf("!!ERROR!!\r\n");
              results.push_back(res);
              timings.push_back(1000.*(now-ref)/cv::getTickFrequency());
            }
            {
              bool res = false;
              auto ref = cv::getTickCount();
              for(size_t k = 0 ; k<iterations ; ++k)
                res = (cv::countNonZero(m)>0);
              auto now = cv::getTickCount();
              const bool error = (res != nz);
              if (error)
                printf("!!ERROR!!\r\n");
              results.push_back(res);
              timings.push_back(1000.*(now-ref)/cv::getTickFrequency());
            }

            const size_t bestTimingIndex = (std::min_element(timings.begin(), timings.end())-timings.begin());
            if ((bestTimingIndex != 0) || (std::find_if_not(results.begin(), results.end(), [&](bool r) {return (r == nz);}) != results.end()))
            {
              std::cout << "cv::hasNonZero\t\t=>" << results[0] << ((results[0] != nz) ? "  ERROR" : "") << "   perf:" << timings[0] << "ms => " << (iterations/timings[0]*1000) << " im/s" << ((bestTimingIndex == 0) ? " * " : "") << std::endl;
              std::cout << "cv::countNonZero\t=>" << results[1] << ((results[1] != nz) ? "  ERROR" : "") << "   perf:" << timings[1] << "ms => " << (iterations/timings[1]*1000) << " im/s" << ((bestTimingIndex == 1) ? " * " : "") << std::endl;
            }
          }
        }
      }
    }
  }

```

Here is a report of this benchmark (it only reports timings when `cv::countNonZero()` is faster)
My CPU is an Intel Core I7 4790 @ 3.60Ghz

```

============================================================
size:[32 x 32]  type:0  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:0  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[32 x 32]  type:0  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[32 x 32]  type:0  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[32 x 32]  type:0  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:0  continuous = false  iterations:1000  nz=true  pos=middle
cv::hasNonZero          =>1   perf:0.353764ms => 2.82674e+06 im/s
cv::countNonZero        =>1   perf:0.282044ms => 3.54555e+06 im/s *
============================================================
size:[32 x 32]  type:0  continuous = false  iterations:1000  nz=true  pos=end
cv::hasNonZero          =>1   perf:0.610478ms => 1.63806e+06 im/s
cv::countNonZero        =>1   perf:0.283182ms => 3.5313e+06 im/s *
============================================================
size:[32 x 32]  type:0  continuous = false  iterations:1000  nz=false  pos=none
cv::hasNonZero          =>0   perf:0.630115ms => 1.58701e+06 im/s
cv::countNonZero        =>0   perf:0.282044ms => 3.54555e+06 im/s *
============================================================
size:[32 x 32]  type:2  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:2  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[32 x 32]  type:2  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[32 x 32]  type:2  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[32 x 32]  type:2  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:2  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[32 x 32]  type:2  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[32 x 32]  type:2  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[32 x 32]  type:4  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:4  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[32 x 32]  type:4  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[32 x 32]  type:4  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[32 x 32]  type:4  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:4  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[32 x 32]  type:4  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[32 x 32]  type:4  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[32 x 32]  type:5  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:5  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[32 x 32]  type:5  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[32 x 32]  type:5  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[32 x 32]  type:5  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:5  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[32 x 32]  type:5  continuous = false  iterations:1000  nz=true  pos=end
cv::hasNonZero          =>1   perf:0.607347ms => 1.64651e+06 im/s
cv::countNonZero        =>1   perf:0.467037ms => 2.14116e+06 im/s *
============================================================
size:[32 x 32]  type:5  continuous = false  iterations:1000  nz=false  pos=none
cv::hasNonZero          =>0   perf:0.618162ms => 1.6177e+06 im/s
cv::countNonZero        =>0   perf:0.468175ms => 2.13595e+06 im/s *
============================================================
size:[32 x 32]  type:6  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:6  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[32 x 32]  type:6  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[32 x 32]  type:6  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[32 x 32]  type:6  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[32 x 32]  type:6  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[32 x 32]  type:6  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[32 x 32]  type:6  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:0  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:0  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:0  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:0  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:0  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:0  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:0  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:0  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:2  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:2  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:2  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:2  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:2  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:2  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:2  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:2  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:4  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:4  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:4  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:4  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:4  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:4  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:4  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:4  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:5  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:5  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:5  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:5  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:5  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:5  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:5  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:5  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:6  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:6  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:6  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:6  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[64 x 64]  type:6  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[64 x 64]  type:6  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[64 x 64]  type:6  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[64 x 64]  type:6  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:0  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:0  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:0  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:0  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:0  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:0  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:0  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:0  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:2  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:2  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:2  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:2  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:2  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:2  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:2  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:2  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:4  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:4  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:4  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:4  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:4  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:4  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:4  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:4  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:5  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:5  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:5  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:5  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:5  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:5  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:5  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:5  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:6  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:6  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:6  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:6  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[128 x 128]  type:6  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[128 x 128]  type:6  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[128 x 128]  type:6  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[128 x 128]  type:6  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:0  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:0  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:0  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:0  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:0  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:0  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:0  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:0  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:2  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:2  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:2  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:2  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:2  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:2  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:2  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:2  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:4  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:4  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:4  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:4  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:4  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:4  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:4  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:4  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:5  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:5  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:5  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:5  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:5  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:5  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:5  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:5  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:6  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:6  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:6  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:6  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[320 x 240]  type:6  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[320 x 240]  type:6  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[320 x 240]  type:6  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[320 x 240]  type:6  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:0  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:0  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:0  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:0  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:0  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:0  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:0  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:0  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:2  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:2  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:2  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:2  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:2  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:2  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:2  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:2  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:4  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:4  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:4  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:4  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:4  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:4  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:4  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:4  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:5  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:5  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:5  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:5  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:5  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:5  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:5  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:5  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:6  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:6  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:6  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:6  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[512 x 512]  type:6  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[512 x 512]  type:6  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[512 x 512]  type:6  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[512 x 512]  type:6  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:0  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:0  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:0  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:0  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:0  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:0  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:0  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:0  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:2  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:2  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:2  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:2  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:2  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:2  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:2  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:2  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:4  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:4  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:4  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:4  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:4  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:4  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:4  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:4  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:5  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:5  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:5  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:5  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:5  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:5  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:5  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:5  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:6  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:6  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:6  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:6  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[640 x 480]  type:6  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[640 x 480]  type:6  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[640 x 480]  type:6  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[640 x 480]  type:6  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:0  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:0  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:0  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:0  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:0  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:0  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:0  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:0  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:2  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:2  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:2  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:2  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:2  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:2  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:2  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:2  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:4  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:4  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:4  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:4  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:4  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:4  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:4  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:4  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:5  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:5  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:5  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:5  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:5  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:5  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:5  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:5  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:6  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:6  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:6  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:6  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1024 x 768]  type:6  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1024 x 768]  type:6  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1024 x 768]  type:6  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1024 x 768]  type:6  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[2048 x 2048]  type:0  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:0  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:0  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[2048 x 2048]  type:0  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[2048 x 2048]  type:0  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:0  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:0  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[2048 x 2048]  type:0  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[2048 x 2048]  type:2  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:2  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:2  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[2048 x 2048]  type:2  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[2048 x 2048]  type:2  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:2  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:2  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[2048 x 2048]  type:2  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[2048 x 2048]  type:4  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:4  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:4  continuous = true  iterations:1000  nz=true  pos=end
cv::hasNonZero          =>1   perf:895.381ms => 1116.84 im/s
cv::countNonZero        =>1   perf:882.569ms => 1133.06 im/s *
============================================================
size:[2048 x 2048]  type:4  continuous = true  iterations:1000  nz=false  pos=none
cv::hasNonZero          =>0   perf:899.53ms => 1111.69 im/s
cv::countNonZero        =>0   perf:870.894ms => 1148.24 im/s *
============================================================
size:[2048 x 2048]  type:4  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:4  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:4  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[2048 x 2048]  type:4  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[2048 x 2048]  type:5  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:5  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:5  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[2048 x 2048]  type:5  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[2048 x 2048]  type:5  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:5  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:5  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[2048 x 2048]  type:5  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[2048 x 2048]  type:6  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:6  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:6  continuous = true  iterations:1000  nz=true  pos=end
cv::hasNonZero          =>1   perf:2018.92ms => 495.313 im/s
cv::countNonZero        =>1   perf:1966.37ms => 508.552 im/s *
============================================================
size:[2048 x 2048]  type:6  continuous = true  iterations:1000  nz=false  pos=none
cv::hasNonZero          =>0   perf:2005.87ms => 498.537 im/s
cv::countNonZero        =>0   perf:1992.78ms => 501.812 im/s *
============================================================
size:[2048 x 2048]  type:6  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[2048 x 2048]  type:6  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[2048 x 2048]  type:6  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[2048 x 2048]  type:6  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:0  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:0  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:0  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:0  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:0  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:0  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:0  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:0  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:2  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:2  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:2  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:2  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:2  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:2  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:2  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:2  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:4  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:4  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:4  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:4  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:4  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:4  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:4  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:4  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:5  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:5  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:5  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:5  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:5  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:5  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:5  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:5  continuous = false  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:6  continuous = true  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:6  continuous = true  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:6  continuous = true  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:6  continuous = true  iterations:1000  nz=false  pos=none
============================================================
size:[1031 x 1000]  type:6  continuous = false  iterations:1000  nz=true  pos=begin
============================================================
size:[1031 x 1000]  type:6  continuous = false  iterations:1000  nz=true  pos=middle
============================================================
size:[1031 x 1000]  type:6  continuous = false  iterations:1000  nz=true  pos=end
============================================================
size:[1031 x 1000]  type:6  continuous = false  iterations:1000  nz=false  pos=none
done

```
2023-06-09 13:37:20 +03:00