Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating large sparse images in Julia

Tags:

julia

Is it possible to generate a large sparse image in Julia? The (excellent) library Images.jl by Tim Holy looks like it is meant for full image matrices where one defines every pixel.

enter image description here

I would like to make a bifurcation diagram, which is rather sparse. Ideally I'd like to make one that is poster-size, but the corresponding full image matrix would be way too large to generate.

Thank you for your time.

like image 639
Mageek Avatar asked Aug 18 '15 19:08

Mageek


1 Answers

An Image can be created from any AbstractArray, which includes a sparse matrix:

julia> using Images

julia> S = sprand(10^4, 10^4, 0.01);

julia> img = grayim(S)
Gray Images.Image with:
  data: 10000x10000 Base.SparseMatrix.SparseMatrixCSC{Float64,Int64}
  properties:
    colorspace: Gray
    spatialorder:  x y

Now, what you do with this image will determine how happy you'll be with this. But nothing prevents you from defining it.

UPDATE: Images now treats any AbstractArray as an image, there is no Images type anymore.

like image 178
tholy Avatar answered Oct 22 '22 19:10

tholy