Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why 'imencode' taking so long ?

I'm encoding my image from a opencv "Mat" to a "vector" buffer in order to send it over a socket.

int rows = 4096;
int cols = 4096;
vector<uchar> buffer;

Mat imageFrame(rows, cols, CV_8UC1, dataPointer );    
    /* dataPointer --> Pointer containing image pixel data */
imencode(".bmp", imageFrame, buffer);

The "imencode" function takes time in orders of 20-40 ms.

{ Just for the information purpose, the imageFrame Mat is generated in order of 10ms. }

My System Specs are :

Processor : Intel Core i7-6700TE @2.4 GHz (8-CPUs)

RAM : 16GB (DDR4)

Operating System : Windows 10 Pro 64-bit

Bus Speed : 100 MHz

Please tell me how to speed that up.

Furthermore, Is there any other encoding scheme, besides "BitMap", which can be done faster ?