How to determine if an image/video is pixelated or not

asked 2018-12-05 09:20:47 -0500

tarun.gupta gravatar image

updated 2018-12-05 10:12:28 -0500

berak gravatar image

I have come across a use case where i have to determine if a video/frame is pixelated or not.

I was refering stackoverflowImagepixelation but it doesn't work for me. Please suggest the solution

import numpy as np
import Image, ImageChops

im = Image.open('tryanypixelatedimagefromGoogle.jpeg')    
im2 = im.transform(im.size, Image.AFFINE, (1,0,1,0,1,1))
im3 = ImageChops.subtract(im, im2)
im3 = np.asarray(im3)
im3 = np.sum(im3,axis=0)[:-1]
mean = np.mean(im3)
peak_spacing = np.diff([i for i,v in enumerate(im3) if v > mean*2])
mean_spacing = np.mean(peak_spacing)
std_spacing = np.std(peak_spacing)
print 'mean gap:', mean_spacing, 'std', std_spacing
edit retag flag offensive close merge delete

Comments

could you add, what you actually tried, (on your own) ?

a link to an SO question is not really helpful here.

berak gravatar imageberak ( 2018-12-05 09:22:33 -0500 )edit
1

Its just we have a video quality parameter where we have to determine how pixelated video is, since i am new to open cv so i just wanted to know how to determine pixelation using opencv

tarun.gupta gravatar imagetarun.gupta ( 2018-12-05 09:39:05 -0500 )edit

no, i meant: show your code / image, please ;)

(put it all into your question :)

berak gravatar imageberak ( 2018-12-05 09:45:22 -0500 )edit

i don't see any opencv related code, above ;\

(we can't help with arbitrary python code here)

berak gravatar imageberak ( 2018-12-05 10:33:59 -0500 )edit