I have a problem using functions that are in a different file than the location where I am calling these functions. Basically my project is organized as follows:
Lista_I (Pacote Contendo os Arquivos)
__init__.py
funcoes_uteis.py
PDI.py
In the file PDI.py
I have the following code:
import numpy
def aplicar_mascara_media_aritmetica(imagem):
filtro = numpy.zeros((3, 3))
for i in range(1, len(imagem) - 1):
for j in range(1, len(imagem[0]) - 1):
filtro[0][0] = imagem[i - 1][j - 1]
filtro[0][1] = imagem[i - 1][j]
filtro[0][2] = imagem[i - 1][j + 1]
filtro[1][0] = imagem[i][j - 1]
filtro[1][1] = imagem[i][j]
filtro[1][2] = imagem[i][j + 1]
filtro[2][0] = imagem[i + 1][j - 1]
filtro[2][1] = imagem[i + 1][j]
filtro[2][2] = imagem[i + 1][j + 1]
imagem[i][j] = calcular_media(filtro) #não funciona
return imagem
And in the funcoes_uteis.py
file I have the calcular_media(filtro)
function being called in the PDI.py
file. I already tried to import funcoes_uteis
but it is not working. I do not know if this has to do with the version of python I'm using, but by the way, I'm using version 3.6 of python.
Can anyone help me with this problem? Thank you in advance!