Esempio n. 1
0
def salveSubImg(x, y, w, h, image, ROI_number=0, folder=''):
	
    ROI = image[y:y+h, x:x+w]
    if folder == '':
        cv2.imwrite('ROI_{}.png'.format(ROI_number), ROI)
    else:
        cv2.imwrite(path.path(folder)+'ROI_{}.png'.format(ROI_number), ROI)

#Implementação.:
#cutImg.salveSubImg(ex, ey, ew, eh, image, count, folder)  obs.: criar 'count'
Esempio n. 2
0
scaleFactor = 1.05
minNeighbors = 15

#'''
img = lut.adjust_gamma(img, 2)
#gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

#suave = cv2.GaussianBlur(gray, (7, 7), 0)
#suave = cv2.medianBlur(suave, 7)
#'''

first = []
first1 = []
#importa o classificador de face
face_cascade = cv2.CascadeClassifier(
    path.path('haarcascades') + '/haarcascade_frontalface_default.xml')
#importa o classificador de olho
eye_cascade = cv2.CascadeClassifier(
    path.path('haarcascades') + '/haarcascade_eye.xml')

#Iniciando o algoritmo Blob
blob_parm = cv2.SimpleBlobDetector_Params()
blob_parm.filterByArea = True
blob_parm.maxArea = 1500  #unidade em pixels
blob_dt = cv2.SimpleBlobDetector_create(blob_parm)

#Pré-Processamento
img = cv2.medianBlur(img, 7)
#img = cv2.GaussianBlur(img, (7, 7), 0)

#ALgoritmo de Blob
Esempio n. 3
0
import cv2
import pathFile as path
import getCircle as getc
import lut
import numpy as np
import mahotas

PATH = "ROI_261.png"
img = cv2.imread(path.path('imgs_eyes') + '/' + PATH)

img = lut.adjust_gamma(img, 5)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

suave = cv2.GaussianBlur(gray, (7, 7), 0)
suave = cv2.medianBlur(suave, 7)

#OTSU
'''
T = mahotas.thresholding.rc(suave)
temp = img.copy()
temp[temp > T] = 255
temp[temp < 255] = 0
temp = cv2.bitwise_not(temp)

#ADAPTIVE THRESHOLD

'''
bi = cv2.adaptiveThreshold(suave, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
                           cv2.THRESH_BINARY, 27, -4)  #27, -4
bi = cv2.medianBlur(bi, 3)
bi = cv2.GaussianBlur(bi, (3, 3), 0)
Esempio n. 4
0
'''

#Argumentos do método 'face_cascade.detectMultiScale'(OBS.: está bom para uma curta distância)
scaleFactor = 1.06
minNeighbors = 50

name = "Hey dboa man?"
#name1 = "ihoi"
#folder = "new_imgs"
bar = ["right eye:", "left eye:"]
#count = 0
cam = cv2.VideoCapture(0)
cam.set(cv2.CAP_PROP_FPS, 30)

#importa o classificador de face
face_cascade = cv2.CascadeClassifier(path.path('haarcascades') + '/haarcascade_frontalface_default.xml')
#importa o classificador de olho
eye_cascade = cv2.CascadeClassifier(path.path('haarcascades') + '/haarcascade_eye.xml')

#Iniciando o algoritmo Blob
blob_parm = cv2.SimpleBlobDetector_Params()
blob_parm.filterByArea = True
blob_parm.maxArea = 1500 #unidade em pixels
blob_dt = cv2.SimpleBlobDetector_create(blob_parm)

while(True):
    ret, frame = cam.read()
    #'''
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    
    #aplica o algoritmo de detecção facial