user846400
user846400

Reputation: 1101

Compressing a raw image buffer

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?

Upvotes: 2

Views: 1634

Answers (2)

Prof. Falken
Prof. Falken

Reputation: 24887

I believe Embedded JPEG may be what you are looking for.

Upvotes: 1

Jim Lahey
Jim Lahey

Reputation: 84

Or try the Independent JPEG Group source code.

http://www.ijg.org/

Upvotes: 0

Related Questions