Пример #1
0
        print("Failed to get response from jobserver")
        time.sleep(1)
        continue

    if(response['processed'] == 1):
        print("response is processed")
        time.sleep(1)

    filename = response['filename']
    realFilename = filename

    if(filename[:2] == "._"):
        filename = filename[2:]

    process_start_time = datetime.datetime.utcnow()
    if(not dbHelper.getImageFromAzureBlob(filename, PICTURE_DIR + filename)):
        print("Failed to get image", filename)
        continue

    download_end_time = datetime.datetime.utcnow()
    print("Got image: ", filename, " from blob " + "in " + str((download_end_time - process_start_time).total_seconds()))
    img = cv2.imread(PICTURE_DIR  + filename)
    os.remove(PICTURE_DIR  + filename)

    if img is None:
        print("Image is none!")
        continue

    cascade = cv2.CascadeClassifier('./haarcascade_frontalface_default.xml')
    eyeCascade = cv2.CascadeClassifier('./haarcascade_eye.xml')
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Пример #2
0
    if (response == False):
        print("Failed to get response from jobserver")
        time.sleep(1)
        continue

    if (response['processed'] == 1):
        time.sleep(1)

    filename = response['filename']
    realFilename = filename

    if (filename[:2] == "._"):
        filename = filename[2:]

    dbHelper.getImageFromAzureBlob(filename, "/app/Pics/" + filename)
    print("Got image: ", filename, " from blob")
    img = cv2.imread("/app/Pics/" + filename)

    cascade = cv2.CascadeClassifier('/app/haarcascade_frontalface_default.xml')

    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    gray = cv2.equalizeHist(gray)
    rects = detect(gray, cascade)

    if rects != []:
        sys.stderr.write(
            '\ntrue rect')  # Count the number of images with faces
        sendRes(jobserver_url, realFilename, "true")