GAPI: Kalman filter stateful kernel.#18869
Conversation
10772df to
0b05f55
Compare
In makes sense to separate unrelated commits. |
0b05f55 to
cda8f46
Compare
| #include "opencv2/core/mat.hpp" | ||
| #include "opencv2/core.hpp" | ||
|
|
||
| #undef countNonZero |
There was a problem hiding this comment.
Why is this in public GAPI headers?
There was a problem hiding this comment.
@anna-khakimova countNonZero() is banned for a reason: this function can take ONLY single-channel Mat.
(See #16657)
You can use cv::norm() here instead
There was a problem hiding this comment.
It is banned in tests only.
No idea how this appears in common public header.
There was a problem hiding this comment.
This appear because both headers modules/gapi/include/opencv2/gapi/cpu/video.hpp and modules/gapi/test/test_precomp.hpp are included to one modules/gapi/test/cpu/gapi_video_tests_cpu.cpp. So,
#define countNonZero() countNonZero_is_forbidden_in_tests_use_norm_instead() in test_precomp.hpp affects content of cpu/video.hpp file.
There was a problem hiding this comment.
Do you really need such details in the future?
There was a problem hiding this comment.
Please move this hack to the tests if it is really necessary (or move code implementation into src/, or replace this call)
cv::countNonZero(...) > 0) is slow (and may cause unexpected result overflow which is worse). Replace to
norm(..., NORM_INF) != 0
| struct KalmanParams | ||
| { | ||
| KalmanParams() | ||
| { | ||
| statePre = Mat::zeros(dpDims, 1, type); | ||
| statePost = Mat::zeros(dpDims, 1, type); | ||
| transitionMatrix = Mat::eye(dpDims, dpDims, type); |
There was a problem hiding this comment.
A lot of code in public headers.
Public headers should define API for Users only.
Implementation must go into "src".
/cc @dmatveev
There was a problem hiding this comment.
I think, implementation can be placed in modules/gapi/src/backends/cpu/gcpuvideo.cpp next to the kernel which uses this
|
|
||
| struct KalmanParams |
There was a problem hiding this comment.
Classes in public headers should be properly documented.
| #include "opencv2/core/mat.hpp" | ||
| #include "opencv2/core.hpp" | ||
|
|
||
| #undef countNonZero |
There was a problem hiding this comment.
@anna-khakimova countNonZero() is banned for a reason: this function can take ONLY single-channel Mat.
(See #16657)
You can use cv::norm() here instead
| struct KalmanParams | ||
| { | ||
| KalmanParams() | ||
| { | ||
| statePre = Mat::zeros(dpDims, 1, type); | ||
| statePost = Mat::zeros(dpDims, 1, type); | ||
| transitionMatrix = Mat::eye(dpDims, dpDims, type); |
There was a problem hiding this comment.
I think, implementation can be placed in modules/gapi/src/backends/cpu/gcpuvideo.cpp next to the kernel which uses this
5b02e05 to
256c4a6
Compare
OrestChura
left a comment
There was a problem hiding this comment.
Such a complicated operation! Great!
256c4a6 to
ed88b13
Compare
dmatveev
left a comment
There was a problem hiding this comment.
Thanks @OrestChura for the initial review.
|
@OrestChura please resolve applied conversations. |
eb37623 to
1475a57
Compare
88fad40 to
abbbc9d
Compare
|
@alalek please take a look. |
abbbc9d to
08e90bc
Compare
08e90bc to
c5e9c0d
Compare
c5e9c0d to
d9f8269
Compare
|
@rgarnov , @OrestChura please check |
OrestChura
left a comment
There was a problem hiding this comment.
Great job! Thank you!
The remaining comments are minor, you may apply if there are further iterations
|
@alalek please review. |
|
Overall look good to me. |
d9f8269 to
96741f5
Compare
|
@alalek comments were addressed. Please check. |
|
@alalek thank you. |
* GAPI: Kalman filter stateful kernel * Applied comments * Applied comments. Second iteration * Add overload without control vector * Remove structure constructor and dimension fields. * Add sample as test * Remove visualization from test-sample + correct doxygen comments * Applied comments.
New stateful Kalman filter kernel for GAPI.
@OrestChura, @rgarnov, @AsyaPronina please review.
Published for review on 19th of November.