Ask Your Question
0

how to get JPG compressed image yuv/rgb result from source image

asked 2020-03-24 03:14:52 -0600

updated 2020-03-24 07:28:59 -0600

supra56 gravatar 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)
edit retag flag offensive close merge delete

Comments

it is not necessary to encode image

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 ...

berak gravatar imageberak ( 2020-03-24 04:12:31 -0600 )edit

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.

zdengab gravatar imagezdengab ( 2020-03-24 04:27:50 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-03-24 04:44:43 -0600

berak gravatar image

updated 2020-03-24 04:45:50 -0600

please interface libjpeg directly, don't abuse a high-level computer-vision library like opencv for this

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-03-24 03:14:52 -0600

Seen: 1,230 times

Last updated: Mar 24 '20