I capture a raw image from a grayscale camera. When I transfer the image to OpenCV’s IplImage and use cvSaveImage("image.jpg",image), the image is saved with a size of around 160K. Whereas, if I use fwrite function in C to save the image buffer in .pgm format, the saved image size is 1.4M.
My question is:
Does cvSaveImage() compress the image into the specified format while saving? Actually, I am working on a smart camera with ARM platform and I want to avoid the overhead of cross-compiling OpenCV for ARM. How can I compress this image to .jpg without using cvSaveImage, but rather using C functions?
I believe Embedded JPEG may be what you are looking for.