Note that there are some explanatory texts on larger screens.

plurals
  1. POcv::Mat_ to std::vector conversion
    primarykey
    data
    text
    <p>I use OpenCV 2.0, there is a method in the <code>cv::Mat_&lt;_Tp&gt;</code> class:</p> <pre><code>// conversion to vector. operator vector&lt;_Tp&gt;() const; </code></pre> <p>When instantiated, the implementation does not compile on MSVS 2005:</p> <pre><code>template&lt;typename _Tp&gt; inline Mat_&lt;_Tp&gt;::operator vector&lt;_Tp&gt;() const { CV_Assert( rows == 1 || cols == 1 ); return isContinuous() ? vector&lt;_Tp&gt;((size_t)(rows + cols - 1), (_Tp*)data) : (vector&lt;_Tp&gt;)((Mat_&lt;_Tp&gt;)this-&gt;t()); } </code></pre> <p>Is it a new fancy constructor of <code>std::vector</code> that takes <code>size_t</code> and <code>_Tp*</code> from TR1 or something?</p> <p>I thought they could just initialize the vector by an iterator instead:</p> <pre><code>vector&lt;_Tp&gt;((_Tp*)data, (_Tp*)data + rows + cols - 1) </code></pre> <p>Is it a bug, or don't I know something?</p> <p><p></p> <p>UPD. Compiler error text: </p> <pre><code>...\lib\opencv\include\opencv\cxmat.hpp(691) : error C2665: 'std::vector&lt;_Ty&gt;::vector' : none of the 6 overloads could convert all the argument types with [ _Ty=double ] c:\program files\microsoft visual studio 8\vc\include\vector(473): could be 'std::vector&lt;_Ty&gt;::vector(__w64 unsigned int,const _Ty &amp;)' with [ _Ty=double ] while trying to match the argument list '(size_t, double *)' ...\lib\opencv\include\opencv\cxmat.hpp(689) : while compiling class template member function 'cv::Mat_&lt;_Tp&gt;::operator std::vector&lt;_Ty&gt;(void) const' with [ _Tp=double, _Ty=double ] z:\dev\mine\temp\temp\entry.cpp(37) : see reference to class template instantiation 'cv::Mat_&lt;_Tp&gt;' being compiled with [ _Tp=double ] </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload