Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

DiscreteCosineTransform (DCT)

Open songyuc opened this issue 5 years ago • 5 comments

Hi guys, I am a student learning about image processing, and I found that it seemed PIL do not provide DiscreteCosineTransform (DCT) transform, after searching in the documentation. You answer will be appreciated!

songyuc avatar Mar 28 '20 03:03 songyuc

Looking through the code, it looks like the only references to DCT are for encoding or decoding, not for the purpose of image transformation. So, no.

Are you just asking the question, or do you have a need for this?

radarhere avatar Mar 28 '20 11:03 radarhere

I have a need for this, because I need to conduct some experiments with DCT.

songyuc avatar Apr 01 '20 06:04 songyuc

If you're interested, OpenCV supports this operation - https://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html#dct.

If you think you have to choose between using either Pillow or OpenCV, you don't. You can convert images between the two - https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.fromarray and https://stackoverflow.com/questions/14134892/convert-image-from-pil-to-opencv-format

radarhere avatar Apr 05 '20 02:04 radarhere

@radarhere hi, Andrew, thanks for your guide. In fact, I wanted to use pure Pilliow-style code, without any OpenCV code.

songyuc avatar Apr 06 '20 08:04 songyuc