1 | initial version |
// convert the image to JPEG ( in memory! ) std::vector<uchar>outbuf; std::vector<int> params; params.push_back(CV_IMWRITE_JPEG_QUALITY); params.push_back(100); cv::imencode(".jpg", frame, outbuf, params);
then send the outbuf from your socket. i don't think you'll need additional base64
if you want to send an mjpeg stream, not a single image, you want to wrap that with a http-multipart form:
"Server: Mozarella/2.2\r\n" "Accept-Range: bytes\r\n" "Connection: close\r\n" "Content-Type: multipart/x-mixed-replace; boundary=mjpegstream\r\n" "\r\n"
then, for every frame:
sprintf(head,"--mjpegstream\r\nContent-Type: image/jpeg\r\nContent-Length: %lu\r\n\r\n",outlen); write(sock,head,strlen(head)); write(sock,(char*)(&outbuf[0]),outlen);
good luck!