Richard Knop
Richard Knop

Reputation: 83705

How to make this jpeg compression faster

I am using OpenCV to compress binary images from a camera:

vector<int> p;

p.push_back(CV_IMWRITE_JPEG_QUALITY);

p.push_back(75); // JPG quality

vector<unsigned char> jpegBuf;

cv::imencode(".jpg", fIplImageHeader, jpegBuf, p);

The code above compresses a binary RGB image stored in fIplImageHeader to a JPEG image. For a 640*480 image it takes about 0.25 seconds to execute the five lines above.

Is there any way I could make it faster? I really need to repeat the compression more than 4 times a second.

Upvotes: 3

Views: 3581

Answers (2)

abhi-rao
abhi-rao

Reputation: 2785

If you don't mind spending money - consider Intel Performance Primitives - it is blazing fast. AMD has Framewave supposed to API-compatible - I haven't tried it.
BTW - check this link Fast JPEG encoding library

Upvotes: 1

ismail
ismail

Reputation: 47602

Try using libjpeg-turbo instead of libjpeg, it has MMX & SSE optimizations.

Upvotes: 4

Related Questions