Skip to content

core: no implementation for Mat::ptr(Vec<int, n>) #20044

@berak

Description

@berak
System information (version)
  • OpenCV => 4.5,2-pre
  • Operating System / Platform => Windows 64 Bit
  • Compiler => mingw64 (8.1.0)
Detailed description

Mat::ptr() overloads 9,10,19,20 are documented, predeclared, but not defined.

Steps to reproduce
Mat_<int> m(3,4); m << 1,2,3,4,5,6,7,8,9,10,11,12;
int i = m.ptr(Vec2i(1,1)); // expected: 6

resulting in:

C:\Users\admin\AppData\Local\Temp\ccz92Cq8.o:_demo.cpp:(.text.startup+0x2f2): undefined reference to `unsigned char* cv::Mat::ptr<2>(cv::Vec<int, 2> const&)'
collect2.exe: error: ld returned 1 exit status

interestingly, Mat::at(Vec<int,n>) is implemented like this:

template<typename _Tp, int n> inline
_Tp& Mat::at(const Vec<int, n>& idx)
{
CV_DbgAssert( elemSize() == sizeof(_Tp) );
return *(_Tp*)ptr(idx.val);
}

it should be easy to implement the missing definitions in the same way

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions