Skip to content

core: support Mat 1D#18594

Closed
alalek wants to merge 1 commit intoopencv:4.xfrom
alalek:mat_1d
Closed

core: support Mat 1D#18594
alalek wants to merge 1 commit intoopencv:4.xfrom
alalek:mat_1d

Conversation

@alalek
Copy link
Copy Markdown
Member

@alalek alalek commented Oct 16, 2020

WIP

  • UMat alignment
  • compatibility for calcHist() (returns 1D Mat, so minMaxLoc() fails due to (i, 0) instead of (0, i) results)
force_builders=Linux x64,Linux OpenCL,Linux x64 Debug

opencv_onnx::TensorProto_DataType_Name(datatype));
if (tensor_proto.dims_size() == 0)
blob.dims = 1; // To force 1-dimensional cv::Mat for scalars.
CV_CheckEQ(blob.dims, 1, "Tensor is scalar"); // ensure 1-dimensional cv::Mat for scalars
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current list of failed DNN tests require better and accurate handing of shapes in ONNX importer and probably in layers implementations.

We should use 0D tensor (scalar) here. 1D doesn't work properly.

@vpisarev
Copy link
Copy Markdown
Contributor

@fengyuentau, in the following comments I will mark the parts can be moved into a separate PR and polished/integrated separately.

if( dims1 <= 2 && dims2 <= 2 && kind1 == kind2 && sz1 == sz2 && type1 == type2 && !haveMask )
{
_dst.create(sz1, type1);
_dst.createSameSize(*psrc1, type1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate PR

{
int cn = src1.channels();
_dst.create(src1.size(), CV_8UC(cn));
_dst.createSameSize(src1, CV_8UC(cn));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate PR

_dst.create( size(), _type );
else
_dst.create( dims, size, _type );
_dst.create(src.dims, src.size, _type);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate PR

CV_INSTRUMENT_REGION();

CV_Assert(_img.dims() <= 2);
int dims = _img.dims();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate PR

std::swap(minLoc->x, minLoc->y);
if( maxLoc )
std::swap(maxLoc->x, maxLoc->y);
if (minLoc)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate PR

}


TEST(Mat1D, basic)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test would be useful to move to separate PR, but mark it as disabled for now

@fengyuentau
Copy link
Copy Markdown
Member

Thank you @vpisarev ! Let me take a look into the code.

asmorkalov pushed a commit that referenced this pull request Sep 9, 2022
Changes separated from Mat 1D support in core #18594 (#22346)
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
@asmorkalov asmorkalov closed this May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants