2013-07-05 96 views

回答

1

尝试使用OpenCV的功能imencode

说明

bool imencode(const string& ext, const Mat& img, vector<uchar>& buf, const vector<int>& params=vector<int>()) 

vector<uchar> buf; 
Mat matImage = iplImage; 
imencode(".bmp", matImage, buf); 
size = buf.size(); 
copy(buf.begin(), buf.end(), byteArray); 
0

这取决于您是否只想保存该文件或者是否想为其编码结构。

cvSaveImage("foo.bmp",img); // img is your IplImage 

read bitmap file into structure描述了如何定义你的bmp文件一个很好的结构,如果你想从服务器发送它(它的C,但如果你愿意,我想你能适应它)

+0

不保存到文件(性能)。 –

相关问题