[G-API] Fix problems with 1D cv::Mat as graph output#21782
Merged
alalek merged 9 commits intoopencv:4.xfrom Mar 31, 2022
Merged
[G-API] Fix problems with 1D cv::Mat as graph output#21782alalek merged 9 commits intoopencv:4.xfrom
alalek merged 9 commits intoopencv:4.xfrom
Conversation
TolyaTalamanov
commented
Mar 25, 2022
modules/core/src/matrix.cpp
Outdated
|
|
||
| if( data && (d == dims || (d == 1 && dims <= 2)) && _type == type() ) | ||
| { | ||
| if ( d == 1 && _sizes[0] == size[0] ) |
Contributor
Author
There was a problem hiding this comment.
@alalek Could you have a look:
below there is a condition:
if( i == d && (d > 1 || size[1] == 1))
return;
Checking size[1] will cause error, because d <= 1.
Is it valid to check size[1] in that case?
https://github.com/opencv/opencv/blob/4.x/modules/core/src/matrix.cpp#L672
Member
There was a problem hiding this comment.
&& dims == 1 to preserve old behavior for requesting 1D size of pre-allocated 2D.
size[1] was valid (without 1D hacks). We could add dims == 2 precheck there.
TolyaTalamanov
commented
Mar 25, 2022
| { | ||
| GAPI_Assert(!desc.planar); | ||
| mat.create(desc.dims, desc.depth); | ||
| #if !defined(GAPI_STANDALONE) |
Contributor
Author
There was a problem hiding this comment.
Contributor
|
I believe tests should be added to the core OpenCV as well as reviewers should be from the core OpenCV team first |
fbe6b78 to
0484124
Compare
Contributor
Author
|
@alalek Could you have a look, please? |
Contributor
Author
|
@rgarnov Could you have a look, please? |
rgarnov
approved these changes
Mar 30, 2022
Merged
a-sajjad72
pushed a commit
to a-sajjad72/opencv
that referenced
this pull request
Mar 30, 2023
…blems [G-API] Fix problems with 1D cv::Mat as graph output * Fix issues with 1D cv::Mat * Fix cv::Mat::create * Fix standalone build * Add test on 1d mat * Fix warning * Add additional condition * Add more tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
This PR fixes the problem with
1Dcv::Mat as graph output.Problem reproducer:
Build configuration