Commit dba33431 authored by Diego André Sant'Ana's avatar Diego André Sant'Ana 🤞
Browse files

Melhoria de desempenho do arquivo do Extrator de Atributos. Adicionado novo...

Melhoria de desempenho do arquivo do Extrator de Atributos. Adicionado novo extrator chamado KCurvature, responsável por extrair a quantidade de angulos de uma imagem por faixas. Adicionado a funcionalide de extrair frames de videos.
parent 65892d88
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="W29" />
<option value="E501" />
</list>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
import os
from os import listdir
from os.path import isfile, join
import cv2
import threading
def extractFrame( file,caminho):
print(caminho)
newDir="../dataset_20180816/dataframe/"+file.replace(".avi","")
print(newDir)
try:
print("Pasta criada:"+newDir)
os.mkdir(newDir)
except OSError:
print("Pasta existente:"+newDir)
print(caminho+"/"+file)
cap = cv2.VideoCapture(caminho)
counterFrame = 0;
while(counterFrame<5000):
print(counterFrame)
ret, img= cap.read()
if(ret == False):
return
cv2.imwrite(newDir+"/"+str(counterFrame)+".png", img)
counterFrame+=1
cap.release()
def exportFrame():
dir='../dataset_20180816/'
listaArquivo = [f for f in listdir(dir) if isfile(join(dir, f))]
print(listaArquivo)
for r, d, f in os.walk(dir):
for file in f:
if ".avi" in file:
t=threading.Thread(target=extractFrame,args=(file, os.path.join(r, file)))
t.start()
exportFrame()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment