예제 #1
0
def isnude(file):
    #图像压缩处理
    imagePath = IMAGE_DIR + file
    disImg = IMAGE_DIR +"dis"+file
    newImg = resizeImg(ori_img=imagePath,dst_img=disImg,dst_w=300,dst_h=300,save_q=100)

    faces = face("dis"+file)
    n = Nude(newImg)
    n.setFaces(faces)
    # n.resize(1000,1000)
    n.parse()
    # print n.result
    return 1 if n.result else 0
예제 #2
0
def isnude(file):
    #图像压缩处理
    imagePath = IMAGE_DIR + file
    disImg = IMAGE_DIR + "dis" + file
    newImg = resizeImg(ori_img=imagePath,
                       dst_img=disImg,
                       dst_w=300,
                       dst_h=300,
                       save_q=100)

    faces = face("dis" + file)
    n = Nude(newImg)
    n.setFaces(faces)
    # n.resize(1000,1000)
    n.parse()
    # print n.result
    return 1 if n.result else 0
예제 #3
0
    # for (x, y, w, h) in faces:
    #     cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)

    return faces


print('start waiting', time.strftime('%H:%M:%S'))
# n = Nude("/Users/fengxuting/Downloads/testphoto/1464317011202A33605A.jpg")
file = ROOT + "/public/uploads/nude/1464319781149AC72DF3.jpg"
faces = facedetect(file)

#计算人脸面积占整个图片的比例
im = Image.open(file)
ori_w, ori_h = im.size
area = 0
for (x, y, w, h) in faces:
    area = area + w * h

print(file)
print((float(area) / (ori_w * ori_h)) * 100)
n = Nude(file)
n.setFaces(faces)
# n.resize(1000,1000)
n.parse()

# print "",time.strftime()('%H:%M:%S')

print(n.result, n.inspect())

print('stop waiting', time.strftime('%H:%M:%S'))
예제 #4
0
    # for (x, y, w, h) in faces:
    #     cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)

    return faces
print('start waiting', time.strftime('%H:%M:%S'))
# n = Nude("/Users/fengxuting/Downloads/testphoto/1464317011202A33605A.jpg")
file = ROOT+"/public/uploads/nude/1464319781149AC72DF3.jpg"
faces = facedetect(file)

#计算人脸面积占整个图片的比例
im = Image.open(file)
ori_w, ori_h = im.size
area = 0
for (x, y, w, h) in faces :
    area = area+w*h


print(file)
print((float(area)/(ori_w*ori_h))*100)
n = Nude(file)
n.setFaces(faces)
# n.resize(1000,1000)
n.parse()

# print "",time.strftime()('%H:%M:%S')

print(n.result, n.inspect())

print('stop waiting', time.strftime('%H:%M:%S'))