cv::Mat_ and cv::Vec conversion (Bug #3459)


Added by qp z about 11 years ago. Updated about 11 years ago.


Status:Cancelled Start date:2013-12-26
Priority:Normal Due date:
Assignee:qp z % Done:

0%

Category:core
Target version:2.4.9
Affected version:2.4.8 (latest release) Operating System:Windows
Difficulty:Easy HW Platform:x86
Pull request:

Description

I use visual studio 2010 with opencv 2.46,while when I convert Mat_(such as Mat1d,not Mat) to Vec or Matx,I meet a strange mistake,vc says that it can't find the return value in function

template<typename Tp> template<int n> inline Mat<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>() const at <mat.hpp>
we try to solve the problem by change the function to this

template<typename Tp> template<int n> inline Mat<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>() const {
CV_Assert(n % DataType<_Tp>::channels == 0);
Vec<typename DataType<_Tp>::channel_type, n> ret=this->Mat::operator Vec<typename DataType<_Tp>::channel_type, n>();

return ret;
}

History

Updated by Ilya Lavrenov about 11 years ago

  • Category set to core
  • Difficulty set to Easy

Updated by Marek Suppa about 11 years ago

qp z wrote:

I use visual studio 2010 with opencv 2.46,while when I convert Mat_(such as Mat1d,not Mat) to Vec or Matx,I meet a strange mistake,vc says that it can't find the return value in function

template<typename Tp> template<int n> inline Mat<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>() const at <mat.hpp>
we try to solve the problem by change the function to this

template<typename Tp> template<int n> inline Mat<_Tp>::operator Vec<typename DataType<_Tp>::channel_type, n>() const {
CV_Assert(n % DataType<_Tp>::channels == 0);
Vec<typename DataType<_Tp>::channel_type, n> ret=this->Mat::operator Vec<typename DataType<_Tp>::channel_type, n>();

return ret;
}

Where is the code in question located?

I was not able to find it in `./modules/core/include/opencv2/core/mat.hpp`

Updated by Daniil Osokin about 11 years ago

Hi! I've tested:

Mat1d a(3, 1);
a(1) = 0; a(0) = 255; a(2) = 6;
Vec3d b = a;

and this works smoothly. Please attach a code sample to reproduce the bug, otherwise I'm going to close this ticket.

  • Assignee set to qp z
  • Target version set to 2.4.9
  • Affected version changed from 2.4.0 - 2.4.6 to 2.4.8 (latest release)

Updated by Daniil Osokin about 11 years ago

  • Status changed from New to Incomplete

Updated by Daniil Osokin about 11 years ago

  • Status changed from Incomplete to Cancelled

Also available in: Atom PDF