Login

forbidden the porn image

Author:
dingdongquan
Posted:
December 27, 2010
Language:
Python
Version:
Not specified
Tags:
forbidden-the-porn-image porn-image
Score:
3 (after 3 ratings)

forbidden the porn image

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import sys, Image

img_name = sys.argv[1]
img = Image.open(img_name).convert('YCbCr')
w, h = img.size
data = img.getdata()
cnt = 0

for i, ycbcr in enumerate(data):
    y, cb, cr = ycbcr
    if 86 <= cb <= 117 and 140 <= cr <= 168:
        cnt += 1

print '%s %s a porn image.'%(img_name, 'is' if cnt > w * h * 0.3 else 'is not')

More like this

  1. thumbnail an image by limodou 8 years, 3 months ago
  2. Image inlining template tag example by rbeck 4 years, 6 months ago
  3. Sharpening images by rajeshd 8 years, 3 months ago
  4. Handling Image uploading and Delete Old Image in Django by mulianto 3 years ago
  5. Image Standarization by garcia_marc 7 years, 1 month ago

Comments

Please login first before commenting.