Ejemplo n.º 1
0
from accuracyScore2 import accuracy
#from imutils import paths
#import paths #imutils module
#import argparse
import cv2
import os
import glob
import time
import numpy as np

start = time.time()

trainingPath = "/Users/fegvilela/Documents/Unb/TCC/baseDados/training2/"
testingPath = "/Users/fegvilela/Documents/Unb/TCC/baseDados/testing2/"

pngFiles1 = convertImage(trainingPath)

# initialize the local binary patterns descriptor along with
# the data and label lists
desc = LocalBinaryPatterns(30, 9)  # LBP 30 pontos e raio 9 = melhor acurácia
data = []
labels = []
trueClass = []
predClass = []
accuracyList = []

# loop over the training images
for file in pngFiles1:
    # load the image, convert it to grayscale, and describe it
    image = cv2.imread(file)
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
Ejemplo n.º 2
0
from sklearn.preprocessing import LabelEncoder
from imageResize import imResize
#import numpy as np
import cv2
import os
import glob
import time

# Guarda o horário em que o código começou a rodar
start = time.time()

# path para as imagens
imagesPath = "/Users/fegvilela/Desktop/backupImagensTCC/baseImagensMelhorada8/"

#converte todas imagens para png
pngFiles = convertImage(imagesPath)

print("total imagens: %d" % int(len(pngFiles)))

#salva resultado em arquivo
with open("Resultado.txt", "w") as file1:
    # initialize the local binary patterns descriptor along with
    # the data and label lists
    resultsList = []
    data = []
    labels = []
    desc = LocalBinaryPatterns(21,
                               9)  # LBP 21 pontos e raio 9 = melhor acurácia

    #PREPROCESSING AND FEATURE EXTRACTION
    # loop over all images