I have come across a use case where i have to determine if a video/frame is pixelated or not.
I was refering link text but it doesn't work for me. Please suggest the solution
1 | initial version |
I have come across a use case where i have to determine if a video/frame is pixelated or not.
I was refering link text but it doesn't work for me. Please suggest the solution
I have come across a use case where i have to determine if a video/frame is pixelated or not.
I was refering link textstackoverflowImagepixelation
but it doesn't work for me. Please suggest the solution
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