CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
GAPI: Kalman filter stateful kernel. #18869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this in public GAPI headers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is banned in tests only.
No idea how this appears in common public header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need such details in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Changed.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, implementation can be placed in modules/gapi/src/backends/cpu/gcpuvideo.cpp
next to the kernel which uses this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
struct KalmanParams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Classes in public headers should be properly documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Applied.
#include "opencv2/core/mat.hpp" | ||
#include "opencv2/core.hpp" | ||
|
||
#undef countNonZero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such a complicated operation! Great!
256c4a6
to
ed88b13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @OrestChura for the initial review.
@OrestChura please resolve applied conversations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost!!
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, good job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.