/* Insert an image. */
cv::Mat img = cv::imread("logo.png");
// encode image into jpg
cv::vector<uchar> buf;
cv::imencode(".png", img, buf, std::vector<int>() );
// encoded image is now in buf (a vector)
unsigned char *imageBuf = new unsigned char [buf.size()];
memcpy(imageBuf, &buf[0], buf.size());
// size of imageBuf is buf.size();
worksheet_insert_image_buffer(worksheet, 1, 2, imageBuf, buf.size());
workbook_close(workbook);
delete[] imageBuf;
No comments:
Post a Comment