In [11]:
Pkg.add("Images")
Pkg.add("DataFrames")
using Images
using DataFrames


INFO: Cloning cache of Images from git://github.com/timholy/Images.jl.git
INFO: Cloning cache of SIUnits from git://github.com/Keno/SIUnits.jl.git
INFO: Cloning cache of TexExtensions from git://github.com/Keno/TexExtensions.jl.git
INFO: Installing Images v0.4.40
INFO: Installing SIUnits v0.0.4
INFO: Installing TexExtensions v0.0.2
INFO: Building Images
INFO: Package database updated
INFO: METADATA is out-of-date — you may not have the latest version of Images
INFO: Use `Pkg.update()` to get the latest versions of your packages
INFO: Nothing to be done
INFO: METADATA is out-of-date — you may not have the latest version of DataFrames
INFO: Use `Pkg.update()` to get the latest versions of your packages
Warning: New definition 
    +(AbstractArray{T,N},DataArray{T,N}) at /home/jared/.julia/v0.3/DataArrays/src/operators.jl:326
is ambiguous with: 
    +(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:17.
To fix, define 
    +(AbstractImageDirect{T,N},DataArray{T,N})
before the new definition.
Warning: New definition 
    +(AbstractArray{T,N},AbstractDataArray{T,N}) at /home/jared/.julia/v0.3/DataArrays/src/operators.jl:349
is ambiguous with: 
    +(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:17.
To fix, define 
    +(AbstractImageDirect{T,N},AbstractDataArray{T,N})
before the new definition.
Warning: New definition 
    -(AbstractArray{T,N},DataArray{T,N}) at /home/jared/.julia/v0.3/DataArrays/src/operators.jl:326
is ambiguous with: 
    -(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:31.
To fix, define 
    -(AbstractImageDirect{T,N},DataArray{T,N})
before the new definition.
Warning: New definition 
    -(AbstractArray{T,N},AbstractDataArray{T,N}) at /home/jared/.julia/v0.3/DataArrays/src/operators.jl:349
is ambiguous with: 
    -(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:31.
To fix, define 
    -(AbstractImageDirect{T,N},AbstractDataArray{T,N})
before the new definition.
Warning: New definition 
    .*(Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}),AbstractArray{T,N}...) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:282
is ambiguous with: 
    .*(AbstractArray{T,N},AbstractImageDirect{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:46.
To fix, define 
    .*(Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}),AbstractImageDirect{T,N})
before the new definition.
Warning: New definition 
    .*(AbstractArray{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}),AbstractArray{T,N}...) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:282
is ambiguous with: 
    .*(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:45.
To fix, define 
    .*(AbstractImageDirect{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}))
before the new definition.
Warning: New definition 
    .+(AbstractArray{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}),AbstractArray{T,N}...) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:284
is ambiguous with: 
    .+(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:19.
To fix, define 
    .+(AbstractImageDirect{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}))
before the new definition.
Warning: New definition 
    .-(AbstractArray{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:272
is ambiguous with: 
    .-(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:34.
To fix, define 
    .-(AbstractImageDirect{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}))
before the new definition.
Warning: New definition 
    ./(AbstractArray{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:272
is ambiguous with: 
    ./(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:49.
To fix, define 
    ./(AbstractImageDirect{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}))
before the new definition.
Warning: New definition 
    .==(AbstractArray{Bool,N},Union(PooledDataArray{Bool,R<:Integer,N},DataArray{Bool,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:317
is ambiguous with: 
    .==(AbstractImageDirect{Bool,N},AbstractArray{Bool,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:125.
To fix, define 
    .==(AbstractImageDirect{Bool,N},Union(PooledDataArray{Bool,R<:Integer,N},DataArray{Bool,N}))
before the new definition.
Warning: New definition 
    .==(AbstractArray{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:272
is ambiguous with: 
    .==(AbstractImageDirect{Bool,N},AbstractArray{Bool,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:125.
To fix, define 
    .==(AbstractImageDirect{Bool,N},Union(PooledDataArray{Bool,R<:Integer,N},DataArray{Bool,N}))
before the new definition.
Warning: New definition 
    .==(AbstractArray{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:272
is ambiguous with: 
    .==(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:126.
To fix, define 
    .==(AbstractImageDirect{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}))
before the new definition.
Warning: New definition 
    .>(AbstractArray{Bool,N},Union(PooledDataArray{Bool,R<:Integer,N},DataArray{Bool,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:317
is ambiguous with: 
    .>(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:123.
To fix, define 
    .>(AbstractImageDirect{Bool,N},Union(PooledDataArray{Bool,R<:Integer,N},DataArray{Bool,N}))
before the new definition.
Warning: New definition 
    .>(AbstractArray{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:272
is ambiguous with: 
    .>(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:123.
To fix, define 
    .>(AbstractImageDirect{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}))
before the new definition.
Warning: New definition 
    .<(AbstractArray{Bool,N},Union(PooledDataArray{Bool,R<:Integer,N},DataArray{Bool,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:317
is ambiguous with: 
    .<(AbstractImageDirect{Bool,N},AbstractArray{Bool,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:121.
To fix, define 
    .<(AbstractImageDirect{Bool,N},Union(PooledDataArray{Bool,R<:Integer,N},DataArray{Bool,N}))
before the new definition.
Warning: New definition 
    .<(AbstractArray{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:272
is ambiguous with: 
    .<(AbstractImageDirect{Bool,N},AbstractArray{Bool,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:121.
To fix, define 
    .<(AbstractImageDirect{Bool,N},Union(PooledDataArray{Bool,R<:Integer,N},DataArray{Bool,N}))
before the new definition.
Warning: New definition 
    .<(AbstractArray{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N})) at /home/jared/.julia/v0.3/DataArrays/src/broadcast.jl:272
is ambiguous with: 
    .<(AbstractImageDirect{T,N},AbstractArray{T,N}) at /home/jared/.julia/v0.3/Images/src/algorithms.jl:122.
To fix, define 
    .<(AbstractImageDirect{T,N},Union(PooledDataArray{T,R<:Integer,N},DataArray{T,N}))
before the new definition.

In [10]:
f = open("todos_jpg.txt")
archivos = [readlines(f)]
f.close()


type IOStream has no field close
while loading In[10], in expression starting on line 3

In [94]:
function rgb2gray(rgb):
    """
    Convertir a imagenes en escala de grises
    """
    return B = 0.2989*rgb[:,:,1] + 0.5870*rgb[:,:,2] + 0.1140*rgb[:,:,2]
end


Out[94]:
rgb2gray (generic function with 1 method)

In [142]:



Out[142]:
0-element Array{ASCIIString,1}

In [155]:
function iden_images(e)    
    imagenes = ASCIIString[]
    for i = 1:e
        img = imread(archivos[i][1:end-1])
        B = rgb2gray(separate(img))
        if var(B) > .05
            push!(imagenes,archivos[i][1:end-1])
        end
    end
    return imagenes
end


Out[155]:
iden_images (generic function with 1 method)

In [152]:
@time iden_images(1000)


elapsed time: 593.030749793 seconds (299457349376 bytes allocated, 23.47% gc time)
Out[152]:
440-element Array{ASCIIString,1}:
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000017.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000049.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000038.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000022.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000136.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000021.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000057.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000120.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000148.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000140.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000014.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000026.jpg"                              
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000079.jpg"                              
 ⋮                                                                                              
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000038.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000109.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000041.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000017.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000157.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000022.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000193.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000219.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000165.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000218.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000204.jpg"
 "Libros/vida_y_viajes_de_cristobal_colon_washington_irving_1851/jpg/vvcc-1851-int_00000188.jpg"

In [167]:
function iden_images_2(archivo)
    img = imread(archivo[1:end-1])
    B = rgb2gray(separate(img))
    if var(B) > .05
        return archivo[1:end-1] 
    end
end


Out[167]:
iden_images_2 (generic function with 1 method)

In [174]:
@time prueba_imagenes = [iden_images_2(archivos[i]) for i=1:100]


elapsed time: 26.536105334 seconds (14631727504 bytes allocated, 35.97% gc time)
Out[174]:
100-element Array{Any,1}:
 nothing                                                          
 nothing                                                          
 nothing                                                          
 nothing                                                          
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000017.jpg"
 nothing                                                          
 nothing                                                          
 nothing                                                          
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000049.jpg"
 nothing                                                          
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000038.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000022.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000136.jpg"
 ⋮                                                                
 nothing                                                          
 nothing                                                          
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000103.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000100.jpg"
 nothing                                                          
 nothing                                                          
 nothing                                                          
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000030.jpg"
 nothing                                                          
 nothing                                                          
 nothing                                                          
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000053.jpg"

In [175]:
@time iden_images(100)


elapsed time: 26.847395341 seconds (14631731152 bytes allocated, 35.68% gc time)
Out[175]:
34-element Array{ASCIIString,1}:
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000017.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000049.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000038.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000022.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000136.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000021.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000057.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000120.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000148.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000140.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000014.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000026.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000079.jpg"
 ⋮                                                                
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000123.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000018.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000112.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000033.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000058.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000128.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000104.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000075.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000103.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000100.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000030.jpg"
 "Libros/el_hijo_del_ahuizote_tomo_i/jpg/eha-t.i-int_00000053.jpg"

In [ ]: