CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
[G-API] Wrap GArray #18762
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
[G-API] Wrap GArray #18762
Conversation
@TolyaTalamanov The PR still does not pass pre-commit checks. Please take a look on CI. |
3a6c459
to
48e3d24
Compare
48e3d24
to
1940228
Compare
ae2fdaa
to
e3fdd97
Compare
e3fdd97
to
1fc2945
Compare
@dkurt Could you have a look, please ? |
cv.gapi.core.cpu.kernels(), | ||
cv.gapi.core.fluid.kernels() | ||
# cv.gapi.core.plaidml.kernels() | ||
] |
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.
indentation is strange here (use 4 spaces)
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.
Fixed
def test_good_features_to_track(self): | ||
# TODO: Extend to use any type and size here | ||
sz = (720, 1280) | ||
in1 = np.random.randint(0, 100, sz).astype(np.uint8) |
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.
np.random
- input is not determined (no way to reproduce failed test) - we don't want sporadic failures.
- it is better to use some image instead (or draw it)
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.
Fixed
# OpenCV - (num_points, 1, 2) | ||
# G-API - (num_points, 2) | ||
# Comparison | ||
self.assertEqual(0.0, cv.norm(expected.flatten(), actual.flatten(), cv.NORM_INF)) |
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.
for pkg in pkgs
Consider providing clear messages about failures: add information about used "pkg".
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.
Fixed
ccomp.start() | ||
|
||
# Assert | ||
while cap.isOpened(): |
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 limit the number of processed frames.
We really don't need to process all 100 frames here.
/cc @dmatveev This note is actual for other tests too, including C++
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.
Fixed
@alalek @dkurt @smirnov-alexey Could you have a look ? |
{ | ||
switch (info.kind) | ||
{ | ||
case cv::detail::OpaqueKind::CV_POINT2F: |
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'm going to use HostCtor
to avoid switch here in next PR
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.
Good point
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 has been already implemented in PR: #18900
@dmatveev Could you have a look ? |
[G-API] Wrap GArray * Wrap GArray for output * Collect in/out info in graph * Add imgproc tests * Add cv::Point2f * Update test_gapi_imgproc.py * Fix comments to review
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.
Overview
Changes
GTypeInfo
which storesGShape
&GKind
.collectInfo
which collectGTypeInfo
from input/output node handles in theade::Graph
, such kind of information are needed to:GComputation.apply()
doesn't take output args, so need to allocate their inside)cv::Scalar
orcv::Rect
)CV_POINT2F
toGKind
to handleGArray<cv::Point2f>
GGoodFeatures
operationGArray<cv::Point2f>
asGArrayP2f
into python (GArray is supported only for output)Implementation details
GArray
is a template class, so it can't be wrapped to pythonas is
. The solution is wrap all instances corresponding inGKind
. Now only instance forGArray<cv::Point2f>
(cv::GShape::CV_POINT2F)
is wrapped. For this, need to create using on GArraycv::Point2f`:and put this:
to
shadow_gapi.hpp
to force python generate code for this instance.Such principle will be used for wrapping other
GArray
&GOpaque
types.Kind
cv::GKind::CV_UNKNOWN
isn't planned to be supported, yetBuild configuration