1 | initial version |
try this code. i think it shows you a simpler way.
#include "highgui.hpp"
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
vector<double> testVector;
for( int i = 0; i < 65536; i++)
{
testVector.push_back( i % 256 );
}
Mat testMat = Mat( testVector ).reshape( 0, 256 );
testMat.convertTo( testMat, CV_8UC1 );
imshow("testMat",testMat);
waitKey();
}