how to get JPG compressed image yuv/rgb result from source image
I'm trying to compare image difference before/after compression.
Currently, I do it by saving image at certain quality factor as jpeg file and then call imread()
to get the result.
However, the whole process contains several useless steps. For example, it is not necessary to encode image and generate a .jpg file. I would like to skip those unnecessary steps. Are there any approaches to get compressed image result like.
compress_image = CompressAtQuality(source_image, quality_factor)
what ?
but you could at least use imencode()/imdecode() in memory, and skip the read/write step
all in all, it seems, this is the wrong library for you ...
Probably I do not state my question clearly. imencode()/imdecode() still involves encoding image to given format. JPG compression contains following steps:
DCT transform --> drop according to quantization table and quality factor --> Encode as .jpg format.
What I need is the result after dropping according to quality factor only, so I would like to skip entire encode and write process.