Updated by Marina Kolpakova almost 13 years ago
Hi there,
I don't know if it really is a bug but I have a problem when using the
cv::resize function with one-dimensional matrices. I'd like to use linear interpolation to resize a vector (actually stored as a cv::Mat with '1' row and 'n' columns). Here's the example code:
<pre><code class="cpp"> /* CODE */
cv::Mat_<unsigned char> matVector(1,2);
matVector(0,0) = 0;
matVector(0,1) = 31;
cv::Mat matVectorResized;
cv::resize(matVector,matVectorResized,cv::Size(32,1),0,0,cv::INTER_LINEAR);
std::cout<<matVectorResized<<endl;
</code></pre> /* // CODE // */
What I expected was, that I'll get a matrice of 32 colmuns and one row that holds a ramp from '0' to '31', execpt I'm getting this:
matVectorResized = =[0,0,0,0,0,0,0,0,1,3,5,7,9,11,13,15,16,18,20,22,24,26,28,30,31,31,31,31,31,31,31,31]
I don't understand why the linear interpolation won't work on this simple task. Is the cv::resize function only meant for two-dimensional 'images'? Is this simply a problem of correct padding? What do I have to do to correctly resize a one-dimensional matrice?
Regards
Matthias
I don't know if it really is a bug but I have a problem when using the
cv::resize function with one-dimensional matrices. I'd like to use linear interpolation to resize a vector (actually stored as a cv::Mat with '1' row and 'n' columns). Here's the example code:
<pre><code class="cpp"> /* CODE */
cv::Mat_<unsigned char> matVector(1,2);
matVector(0,0) = 0;
matVector(0,1) = 31;
cv::Mat matVectorResized;
cv::resize(matVector,matVectorResized,cv::Size(32,1),0,0,cv::INTER_LINEAR);
std::cout<<matVectorResized<<endl;
</code></pre> /* // CODE // */
What I expected was, that I'll get a matrice of 32 colmuns and one row that holds a ramp from '0' to '31', execpt I'm getting this:
matVectorResized = =[0,0,0,0,0,0,0,0,1,3,5,7,9,11,13,15,16,18,20,22,24,26,28,30,31,31,31,31,31,31,31,31]
I don't understand why the linear interpolation won't work on this simple task. Is the cv::resize function only meant for two-dimensional 'images'? Is this simply a problem of correct padding? What do I have to do to correctly resize a one-dimensional matrice?
Regards
Matthias