CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
GAPI: New BackgroundSubtractor stateful kernel #18674
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
706297c
to
63181be
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.
/cc @dmatveev
@param src input image: 8-bit unsigned 3-channel image @ref CV_8UC3. | ||
@sa RGB2BGR | ||
*/ | ||
GAPI_EXPORTS GMat BGR2RGB(const GMat& src); |
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.
Consider adding RGB2BGR
too (as inlines alias for example).
/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 don't understand your proposal. Please explain.
@sa RGB2BGR | ||
*/ | ||
GAPI_EXPORTS GMat BGR2RGB(const GMat& src); | ||
|
||
//! @} gapi_filters | ||
|
||
//! @addtogroup gapi_colorconvert |
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.
Perhaps it is better to move these doxygen headers instead of the function.
Keep patches small.
How is this change related to this PR? Each PR should have single clear purpose.
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 noticed that this description accidentally was put into the wrong documentation group and I corrected that. Nothing criminal. This is my code from the previous PR. It seems to me that we shouldn't approach this issue so formally.
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.
outdated
|
||
@sa BackSubMOG2 | ||
*/ | ||
GAPI_EXPORTS GMat BackSubMOG2(const GMat& src); |
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.
OpenCV implementation of this algorithm has several parameters. Why do we lose them?
createBackgroundSubtractorMOG2(int history=500, double varThreshold=16,
bool detectShadows=true);
BackSubMOG2
Do we really want to obfuscate function name?
@sa BackSubMOG2
Points on that? on this function again?
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.
Addressed
|
||
static void run(const cv::Mat& in, cv::Mat &out, cv::BackgroundSubtractorMOG2& state) | ||
{ | ||
state.apply(in, out, -1); |
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.
double learningRate
Lost this parameter too.
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.
Changed
@anna-khakimova Friendly reminder. |
e551028
to
f83166d
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.
Great!
07966fe
to
cd914d1
Compare
0e65bae
to
4b6636e
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.
Almost nothing left, some minor suggestions
4b6636e
to
9bc1f67
Compare
@alalek please take a look one more. |
Values(500, 400, 300, 550), | ||
Values(true, false), | ||
Values(-1, 0, 0.5, 1), | ||
Values("cv/video/768x576.avi"))); |
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.
[----------] 256 tests from BackgroundSubtractorTestCPU/BackgroundSubtractorTest (413881 ms total)
This one test case consumes the 2x times more than other 30+k G-API tests.
Keep tests fast.
Do not enable tests if they don't increase code coverage.
TODO:
- please reduce amount of enabled test cases (you may want to create "full" case for development disabled by default).
- reduce amount of processed frames (no need to process all 100 frames of video, 3-5 frames should be enough)
/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.
Ok. Done
|
||
namespace cv { namespace detail { | ||
template<> struct CompileArgTag<cv::gapi::video::BackgroundSubtractorParams> | ||
{ |
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.
avoid indentation in namespaces
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.
Changed.
double threshold = 16; //!< For MOG2: Threshold on the squared Mahalanobis distance between | ||
//!< the pixel and the model to decide whether a pixel is well described by the background model. | ||
//!< For KNN: Threshold on the squared distance between the pixel and the sample to decide | ||
//!< whether a pixel is close to that sample. |
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 better to keep multi-line comments before declaration to avoid excessive indentations.
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 did as you said on the previous step, but doxygen misinterpreted the comments in this arrangement. @OrestChura can confirm my words. He also observed this behavior. I can prove it by rolling back, but I don't want to waste time on it. So I would rather leave it as it is now.
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.
misinterpreted the comments
//!<
Please learn how to use doxygen comments: https://www.doxygen.nl/manual/docblocks.html
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. Thanks for prompt. Changed
@@ -21,5 +21,4 @@ GAPI_EXPORTS GKernelPackage kernels(); | |||
} // namespace gapi | |||
} // namespace cv | |||
|
|||
|
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.
unnecessary change
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.
Removed.
c1fb3a5
to
e5ed281
Compare
c0b2f0c
to
0bcc830
Compare
@OrestChura please take a look one more time. And if it's ok please remove change request and approve. |
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 don't see any other obstacles to merge it! Thank you!
@alalek please check. |
try | ||
{ | ||
gapiBackSub.setSource(gapi::wip::make_src<cv::gapi::wip::GCaptureSource> | ||
(findDataFile(filePath))); | ||
} | ||
catch (...) | ||
{ throw SkipTestException("Video file can't be opened."); } |
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 out findDataFile
call from try-catch block. We don't want to suppress its exceptions.
catch (...)
it make sense to capture const cv::Exception&
only.
/cc @mpashchenkov
88eca7f
to
5d66c72
Compare
5d66c72
to
8ca1f57
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.
LGTM
…ractor GAPI: New BackgroundSubtractor stateful kernel * New BackgroundSubtractorMOG2 kernel * Add BS parameters
New BackgroundSubtractor kernel represents 2 types of operation such as:
Background Subtractor MOG2 (default);
Background Subtractor KNN
@dmatveev , @OrestChura , please take a look.