# Use fourier transform to calculate image pixelation coef in python

I want to calculate a coef of image pixelation to remove bad pictures from a bunch of files.

Some pictures results from bad compression and we can see a lot of pixelation on them like img a here: http://imgur.com/IdLvd

I have heard of Fourier transform to calculate repetitive pattern, maybe it can be used in this case to detect pixel square ?

any kind of code making it possible is welcome.

• Are these images coded using a variety of different techniques or just JPEG (for example)? – Eric Oct 19 '12 at 5:04
• I extract them from videos (mainly encoded with flv and sometime h264) with ffmpeg so I think I can extract them as raw any other formats. – kollo Oct 19 '12 at 13:42
• By "pixelation" you mean lossy compression "jaggy" artifacts? You mean you want to know which files were compressed at too high of a ratio? Does the file format store the compression ratio in its metadata? – endolith Oct 19 '12 at 13:51
• ffmpeg -i filename.flv says Stream #0.0: Video: flv, yuv420p, 720x576, 200 kb/s, 29.97 tbr, 1k tbn, 1k tbc "200 kb/s" is what you want to know. Stream #0.0(und): Video: mpeg4, yuv420p, 176x144 [PAR 1:1 DAR 11:9], 270 kb/s, PAR 12:11 DAR 4:3, 10 fps, 10 tbr, 1k tbn, 10 tbc – endolith Oct 19 '12 at 14:05