-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOthers.py
More file actions
34 lines (31 loc) · 883 Bytes
/
Others.py
File metadata and controls
34 lines (31 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
__author__ = 'vaf'
import numpy as np
import os
def GetImagenes(directorio=os.getcwd(), formato='jpg'):
currentdir = os.listdir(directorio)
imagenes = [currentdir[i] if currentdir[i][-3:] == formato else 0 for i in range(len(currentdir))]
imagenes.sort()
while True:
try:
imagenes.remove(0)
except:
break
return imagenes
def promedio(out):
prom = 0
for i in range(len(out)):
for j in range(len(out[0])):
prom += np.mean(out[i][j])/(len(out)*len(out[0]))
return prom
def isfocus(out, promed = 0):
salida = []
fila = []
for i in range(len(out)):
for j in range(len(out[0])):
if np.mean(out[i][j])>promed:
fila.append(1)
else:
fila.append(0)
salida.append(fila)
fila=[]
print np.asarray(salida)