I make a frame from the camera using avicap32 ... In the CALLBACK frame capture function, I get a pointer to the VIDEOHDR structure. Now you need to take lpVHDR->lpData and somehow make it a buffer with compressed JPEG.
When I captured a frame in a browser using JS (getUserMedia), then from a canvas, base64-jpeg of ~ 13 Kb was obtained (at a compression of 50% at a resolution of 320x240). It is necessary to somehow make such compression in C ++, since the current raw binary weighs ~ 200 Kb, which is a bit too much for the tasks.
Can you please tell lpVHDR->lpData how to make a JPEG from lpVHDR->lpData and compress it? It is desirable, of course, without third-party libraries (probably using GDI +), but if I can’t do without them, I’ll figure it out. Just give direction please))
PS: it is not necessary to save the file, since the "communication" with the hard disk will affect the speed of the application. JPEG is needed in the buffer for later sending to the server.
Initialization of format and resolution after calling capDriverConnect :
capGetVideoFormat(HStream, &BitmapInfo, sizeof(BitmapInfo)); BitmapInfo.bmiHeader.biWidth = 320; BitmapInfo.bmiHeader.biHeight = 240; BitmapInfo.bmiHeader.biCompression = 0x32595559; BitmapInfo.bmiHeader.biSizeImage = 153600; capSetVideoFormat(HStream, &BitmapInfo, sizeof(BitmapInfo)); If you set BI_JPEG in biCompression , then capSetVideoFormat returns FALSE for some reason.
GdipCreateBitmapFromStream. - nick_n_aGdipCreateBitmapFromScan0. 3. If this is a compressed stream - we are looking for how to compress and do 1 or 2. Link to msdn GDI + - nick_n_a