Primitive drawing in array (Luxor & JuliaImages)

I’m trying to do some probabilistic programming and generate some ellipses to look like the target image. In theory this can work but it is quite slow as the way I’m drawing ellipses is using Luxor. As far as I can see, the only way to compare images (and compute a difference score) is to write Luxor’s drawing surface to file and then read it via the JuliaImages library. As I expect to do this comparison many times, writing to file and then reading is very slow.

Is there a way to rasterize the drawing by Luxor into a N-D image? If not, what other libraries can I use to directly draw onto an N-D array?

In Cairo.jl (which is btw the infrastructure to Luxor) you could draw to Image surfaces, to which you provide a data array.

This is part of runtests
# fill 1/4 (upper quarter)

    z = zeros(UInt32,512,512);
    surf = CairoImageSurface(z, Cairo.FORMAT_ARGB32)
    # fills a 256x256 pixel area with blue,0.5 by using a hilbert curve of
    # dimension 32 (scaled by 8 -> 256) and a linewidth of 8

    d = simple_hist(

Thank you. That was exactly what I was looking for!

I thought this might be a good thing to try to add, so I’m in the process of trying to add it:

Currently not working too badly on master but time will tell…

1 Like