c++ - Writing uchar* data to file -


I am using the OpenCV library, which has a class named Mat Data stored in an array on the uchar * Mat :: data , representing the matrix. I want to write this data in a binary file using C ++.

Here's my code:

  cv :: Mat m (3, 3, CV_8UC1); // It basically creates 3-by-3 matrix std :: fstream fileOut ("file.bin", std :: ios :: out | std :: ios :: binary); FileOut.write ((* four *), m.data, 9); // It should write 9 bytes of data   

and I get an error message: Invalid conversion from uchar * * alias * unsigned char * } 'To' std :: basic_istream & lt; Char & gt; :: char_type * {aka char *} '

What should I do differently?

reinterpret_cast & lt; Const char * & gt; (M.data)

Use


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -