Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

here i have a code that works fine in my pc let me know if u have any problem

    int main(int argc, char** argv)
    {
  Mat image;
 VideoCapture cap(0);
 cap>>image;
int i=image.type();
 cout<<i;//if it prints 16 then your data pointer is int unsigned 

 ofstream fout("file.txt");
int unsigned *ptr;
ptr=(unsigned int *)image.data;

 for(int i=0; i<(image.rows); i++)
{
    for(int j=0; j<image.cols; j++){
        fout<<*ptr<<"\t";
        ptr++;
    }
    fout<<endl;
}
fout.close();

}