示例#1
0
    def isnude(self, file):
        #图像压缩处理
        imagePath = IMAGE_DIR + file
        nudeImg = IMAGE_DIR + "nude_" + file
        # print(nudeImg)
        # disImg = IMAGE_DIR +file
        self.resizeImg(ori_img=imagePath,
                       dst_img=nudeImg,
                       dst_w=600,
                       dst_h=600,
                       save_q=100)

        # faces = self.face("dis"+file)
        faces = self.face("nude_" + file)
        if (len(faces) < 1):
            print("no face")
            return -1
        else:
            self.cropImg("nude_" + file, faces)
        n = Nude(nudeImg)
        # n = Nude(newImg)
        # n.setFaces(faces)
        # n.resize(1000,1000)
        n.parse()
        # print n.result
        print(n.result, n.inspect(), '\n<br/>')

        print('stop waiting', time.strftime('%H:%M:%S'), '\n<br/>')
        return 1 if n.result else 0
示例#2
0
def run(argv):
    for index in range(1, len(argv)):
        filename = str(argv[index])
        n = Nude(filename)
        n.parse()
        print(filename, n.result, n.inspect())
    return 0
示例#3
0
def main():
    if len(sys.argv) < 2:
        print("Usage: {0} <image>".format(sys.argv[0]))
        return 1
    # else
    fname = sys.argv[1]
    print(is_nude(fname))

    n = Nude(fname)
    n.parse()
    print("{0}: {1} {2}".format(fname, n.result, n.inspect()))
    return 0
示例#4
0
def main():
    if len(sys.argv) < 2:
        print("Usage: {0} <image>".format(sys.argv[0]))
        return 1
    # else
    fname = sys.argv[1]
    print(is_nude(fname))

    n = Nude(fname)
    n.parse()
    print("{0}: {1} {2}".format(fname, n.result, n.inspect()))
    return 0
示例#5
0
文件: main.py 项目: folowing/nude.py
def process(path):
    try:
        n = Nude(path)
        n.parse()
        logger.info('path:%s, result:%s, detail:%s', path, n.result, n.inspect())

        if n.result:
            shutil.copy(path, porn_dir)
        else:
            shutil.copy(path, not_porn_dir)

    except Exception as err:
        logger.error('image error')
示例#6
0
def main():
    # 請插入媒體文件進行分析
    __media_data = input("Please insert a media file for analysis: ")
    __isNude = Nude(__media_data)
    __isNude.parse()
    __isNudeInspection = __isNude.inspect()
    __isNudeResult = __isNude.result
    if "Nude!!" in __isNudeInspection:
        #print("result  ", __isNude.result, __isNude.inspect())
        # 結果: 該圖片包含色情數據
        output = """
        { 
            "nude" = "true";
        }; 
        """
        print(output)
    else:
        # 結果: 該圖片不包含色情數據
        output = """
        { 
            "nude" = "false";
        }; """
        print(output)
示例#7
0
    def isnude(self,file):
        #图像压缩处理
        imagePath = IMAGE_DIR + file
        nudeImg = IMAGE_DIR +"nude_"+file
        # disImg = IMAGE_DIR +file
        self.resizeImg(ori_img=imagePath,dst_img=nudeImg,dst_w=300,dst_h=300,save_q=100)

        # faces = self.face("dis"+file)
        faces = self.face("nude_"+file)

        if(len(faces)<1):
            print("no face")
            return -1
        else:
            self.cropImg("nude_"+file, faces)

        n = Nude(nudeImg)
        # n = Nude(newImg)
        # n.setFaces(faces)
        # n.resize(1000,1000)
        n.parse()
        print(n.result, n.inspect(), '\n<br/>')
        # print n.result
        return 1 if n.result else 0
示例#8
0
__FILENAME__ = testnude
import nude
from nude import Nude

#print("damita :", nude.is_nude('./images/damita.jpg'))
#print("damita2:", nude.is_nude('./images/damita2.jpg'))
#print("test6  :", nude.is_nude('./images/test6.jpg'))
#print("test2  :", nude.is_nude('./images/test2.jpg'))

n = Nude('./images/damita.jpg')
n.parse()
print(n.result, n.inspect())

n = Nude('./images/damita2.jpg')
n.parse()
print(n.result, n.inspect())

n = Nude('./images/test6.jpg')
n.parse()
print(n.result, n.inspect())

n = Nude('./images/test2.jpg')
n.parse()
print(n.result, n.inspect())

########NEW FILE########
__FILENAME__ = nude
#!/usr/bin/env python
# encoding: utf-8

from __future__ import (absolute_import, division, print_function,
示例#9
0
from __future__ import print_function

import time
import os
from nude import Nude

ROOT = os.path.dirname(os.path.abspath(__file__))

start = time.time()
n = Nude(os.path.join(ROOT, 'images/damita.jpg'))
n.parse()
print(time.time() - start)
print(n.result, n.inspect())

# start = time.time()
# n = Nude(os.path.join(ROOT, 'images/damita2.jpg'))
# n.parse()
# print(time.time() - start)
# print(n.result, n.inspect())
#
# start = time.time()
# n = Nude(os.path.join(ROOT, 'images/test6.jpg'))
# n.parse()
# print(time.time() - start)
# print(n.result, n.inspect())
#
# start = time.time()
# n = Nude(os.path.join(ROOT, 'images/test2.jpg'))
# n.parse()
# print(time.time() - start)
# print(n.result, n.inspect())
示例#10
0
import nude
from nude import Nude

print(nude.is_nude('images.jpg'))
m = Nude('img.webp')

m.parse()
print("damita_1 :", m.result, m.inspect())
n = Nude('images2.jpg')
n.parse()
print("damita_2 :", n.result, n.inspect())
示例#11
0
#coding:utf-8
'''
基于肤色的裸体图像检测
'''
import nude
from nude import Nude

print(nude.is_nude('datas/images/test2.jpg'))

n = Nude('datas/images/test2.jpg')
n.parse()
print("damita :", n.result, n.inspect())
示例#12
0
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

    # Detect faces in the image
    faces = facecascade.detectMultiScale(
        gray,
        scaleFactor=1.1,
        minNeighbors=5,
        minSize=(30, 30),
        flags=cv2.cv.CV_HAAR_SCALE_IMAGE
    )

    # print("Found {0} faces!".format(len(faces)))

    # Draw a rectangle around the faces
    # for (x, y, w, h) in faces:
    #     cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)

    return faces

newImg = resizeImg(ori_img=file,dst_img=disImg,dst_w=300,dst_h=300,save_q=100)

faces = facedetect(newImg)
n = Nude(newImg)
n.setFaces(faces)
# n.resize(1000,1000)
n.parse()

print(n.result, n.inspect(), '\n<br/>')

print('stop waiting', time.strftime('%H:%M:%S'), '\n<br/>')