Q:

How to convert IplImage opencv to byte array (bmp format) C++?

Client recieve image (Image.FromStream) over network (Windows Forms C#). Server send image as byte array (bmp format). How to convert IplImage opencv to byte array (bmp format) C++? Without saving to a file (performance).

A:

Try to use opencv function imencode
Description
bool imencode(const string& ext, const Mat& img, vector<uchar>& buf, const vector<int>& params=vector<int>())

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

