[Python-es] cosa rara con la función shape()
Kiko
kikocorreoso en gmail.com
Mie Mayo 11 23:13:22 CEST 2011
los print excesivos que se leen son para corroborar el funcionamiento
> raro, porque no me cuadra la salida de la función. Un ejemplo de la
>> salida de esa función es lo siguiente:
>>
>> <type 'numpy.ndarray'>
>> <type 'numpy.ndarray'>
>> (60, 60) (9, 9)
>> 60 60
>> 9 9
>> 52
>> 52
>> [[ 52.05549424 52.05549424]] <----- Aquí está lo extraño
>>
>>
A mí me funciona perfectamente:
import numpy as np
a_filtro = np.zeros((3,3))
b_imagen = np.zeros((10,12))
def tam_convo(filtro,imagen):
ii_i, jj_i = np.shape(imagen)
ii_f, jj_f = np.shape(filtro)
print type(imagen)
print type(filtro)
print np.shape(imagen), np.shape(filtro)
print ii_i, jj_i
print ii_f, jj_f
xx=(ii_i-ii_f)+1
yy=(jj_i-jj_f)+1
print xx
print yy
return xx, yy
tam_convo(a_filtro, b_imagen)
Outputs:
<type 'numpy.ndarray'>
<type 'numpy.ndarray'>
(10, 12) (3, 3)
10 12
3 3
8
10
(8, 10)
np.__version__
'1.5.1'
sys.version
'2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)]'
sys.platform
'win32'
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://mail.python.org/pipermail/python-es/attachments/20110511/ee28e6bd/attachment.html>
Más información sobre la lista de distribución Python-es