Merge pull request #18857 from OrestChura:oc/kmeans
authorOrest Chura <orest.chura@intel.com>
Mon, 30 Nov 2020 13:18:43 +0000 (16:18 +0300)
committerGitHub <noreply@github.com>
Mon, 30 Nov 2020 13:18:43 +0000 (13:18 +0000)
commit986ad4ff061ae7acbd6f79d82f1107679f8454b6
tree2d504173d960f04bd18a9be756709e8d4471b4c7
parent95ce8f45ea1c4795ddb131c0c15760fb3b2571a1
Merge pull request #18857 from OrestChura:oc/kmeans

[G-API]: kmeans() Standard Kernel Implementation

* cv::gapi::kmeans kernel implementation
 - 4 overloads:
    - standard GMat - for any dimensionality
    - GMat without bestLabels initialization
    - GArray<Point2f> - for 2D
    - GArray<Point3f> - for 3D
 - Accuracy tests:
   - for every input - 2 tests
   1) without initializing. In this case, no comparison with cv::kmeans is done as kmeans uses random auto-initialization
   2) with initialization
   - in both cases, only 1 attempt is done as after first attempt kmeans initializes bestLabels randomly

* Addressing comments
 - bestLabels is returned to its original place among parameters
 - checkVector and isPointsVector functions are merged into one, shared between core.hpp & imgproc.hpp by placing it into gmat.hpp (and implementation - to gmat.cpp)
 - typos corrected

* addressing comments
 - unified names in tests
 - const added
 - typos

* Addressing comments
 - fixed the doc note
 - ddepth -> expectedDepth, `< 0 ` -> `== -1`

* Fix unsupported cases of input Mat
 - supported: multiple channels, reversed width
 - added test cases for those
 - added notes in docs
 - refactored checkVector to return dimentionality along with quantity

* Addressing comments
 - makes chackVector smaller and (maybe) clearer

* Addressing comments

* Addressing comments
 - cv::checkVector -> cv::gapi::detail

* Addressing comments
 - Changed checkVector: returns bool, quantity & dimensionality as references

* Addressing comments
 - Polishing checkVector
 - FIXME added

* Addressing discussion
 - checkVector: added overload, separate two different functionalities
 - depth assert - out of the function

* Addressing comments
 - quantity -> amount, dimensionality -> dim
 - Fix typos

* Addressing comments
 - fix docs
 - use 2 variable's definitions instead of one (for all non-trivial variables)
modules/gapi/include/opencv2/gapi/core.hpp
modules/gapi/include/opencv2/gapi/gmat.hpp
modules/gapi/include/opencv2/gapi/imgproc.hpp
modules/gapi/src/api/gmat.cpp
modules/gapi/src/api/kernels_core.cpp
modules/gapi/src/backends/cpu/gcpucore.cpp
modules/gapi/test/common/gapi_core_tests.hpp
modules/gapi/test/common/gapi_core_tests_inl.hpp
modules/gapi/test/common/gapi_tests_common.hpp
modules/gapi/test/cpu/gapi_core_tests_cpu.cpp