How to compress JP2 file with OpenCV [closed]
Hello,
I am forced to deal with JP2 images for this case.
Here is the process :
Original image : 59Ko.
Converting to JPG for doing OpenCV things faster : 32Ko.
Converting back to JP2 : 170Ko.
I "convert" using the cv2.imwrite function.
From here, how to compress with OpenCV this JP2 image ?
Thank you for your help.
why use opencv for this ?
Because I use this tool and if it is possible, it's convenient to me. Anyway, if you have another tool, I take.
it's still unclear, what you're doing, and where the problem is. look at it again, please.
Unclear ? My question is "How to compress a JP2 image with OpenCV ?".
For example, using a JPG image, you can do : cv2.imwrite(path, img, [int(cv2.IMWRITE_JPEG_QUALITY), 80])
How to do it for a JP2 image ?
ah, so the compression params are the problem ?
quick glance at the src code shows -- it does not use any.
the
IMWRITE_JPEG_XXXX
flags are only used for.jpg
not for.jp2
.in other words, you can write jp2 files, but there's no control about compression,chroma, or anything else.
would that answer it ?
I don't exactly know how compression for pictures work, especially concerning the JP2 format.
What I finally would like is just to reduce the final size of the picture.
So impossible to do that in OpenCV ?
Do you know any library in Python able to do that ?
sorry, i have no idea (maybe someone else).
we can help you with opencv problems, but not recommend arbitrary python libs.
Thank you for your help!