Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

disable JPEG compression in openCV

Avatar of CSecurity
CSecurityFlag for Iran, Islamic Republic of asked on
11 Comments1 Solution4319 ViewsLast Modified:

I use openCV for steganography analysis (educationol purpose). I load an image (say 300Kb) and edit it's pixels:

BYTE *data = (BYTE*)img->imageData;
//do some changes

then, when going to save the data[] array:
cvSaveImage("c:\\result.jpg", img);

result is compressed (like 20Kb). I dont want JPEG compression, I want data[] array be saved excatly in result.jpg. I googled and found that I can save like this:
int p[3] = {1,100,0};
!cvSaveImage("c:\\result.bmp", img, p);
//code from http://stackoverflow.com/questions/801054/opencv-cvsaveimage-jpeg-compression-factor

but could not use third parameter as I want. I change second parameter but always there is a compression.

so, I want one of these:
1- my question's answer :)
2- recommend a jpeg library that doesn't compress. but please recommend just if you have experience and know that doesn't do compression.
3- any applicable idea that solves my problem

Avatar of davesgonebananas
davesgonebananasFlag of United Kingdom of Great Britain and Northern Ireland image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answers