Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The problem of the mask?

I don't know how to use the mask. Some problem has occur when i use the following codes,but i don't know why. please help me to understand.thank you!

include<iostream>

include<opencv2 core="" core.hpp="">

include<opencv2 highgui="" highgui.hpp="">

using namespace std; using namespace cv; int main() { Mat_<float> m(3, 3); m << 1.0f, 2.0f, 3.9f, 4.0f, 5.0f, 6.0f, 7.7f, 8.0f, 9.0f;

Mat_<int> mask1(3, 3);
mask1 << 1, 2, 3, 0,1,2,3,0,0;

Mat m2;
m.copyTo(m2,mask1);

cout<< m2 << endl;

   system("pause");

}

The problem of the mask?

I don't know how to use the mask. Some problem has occur when i use the following codes,but i don't know why. please help me to understand.thank you!

include<iostream>

include<opencv2 core="" core.hpp="">

include<opencv2 highgui="" highgui.hpp="">

using namespace std; using namespace cv; int main() { Mat_<float> m(3, 3); m << 1.0f, 2.0f, 3.9f, 4.0f, 5.0f, 6.0f, 7.7f, 8.0f, 9.0f;

Mat_<int> mask1(3, 3);
mask1 << 1, 2, 3, 0,1,2,3,0,0;

Mat m2;
m.copyTo(m2,mask1);

cout<< m2 << endl;

   system("pause");

}

The problem of the mask?

I don't know how to use the mask. Some problem has occur when i use the following codes,but i don't know why. please help me to understand.thank you!

include<iostream>

#include<iostream>
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
  

include<opencv2 core="" core.hpp="">

include<opencv2 highgui="" highgui.hpp="">

using namespace std; using namespace cv; int main() { Mat_<float> m(3, 3); m << 1.0f, 2.0f, 3.9f, 4.0f, 5.0f, 6.0f, 7.7f, 8.0f, 9.0f;

9.0f;
 Mat_<int> mask1(3, 3);
 mask1 << 1, 2, 3, 0,1,2,3,0,0;

 Mat m2;
 m.copyTo(m2,mask1);

 cout<< m2 << endl;

    system("pause");
}

}