The Julia language recently released their 1.0 version. We had already heard about the language since it is part of what gives
project Jupyter its name, but we had never used it before. So this post is about our first experience with Julia.
Next we were looking for a good IDE to use with Julia. We were recommended Juno which is a plugin for Atom. Installing Atom was a bit difficult since we first had to install some dependencies, namely redhat-lsb-core and libXScrnSaver, but once we had Atom we could install Juno through Atoms plugin manager.
Set up
We enjoy using conda to install software and libraries, which is why we installed Julia with conda:$ conda install -c conda-forge julia
Next we were looking for a good IDE to use with Julia. We were recommended Juno which is a plugin for Atom. Installing Atom was a bit difficult since we first had to install some dependencies, namely redhat-lsb-core and libXScrnSaver, but once we had Atom we could install Juno through Atoms plugin manager.
Julia image processing
We have a bit of background in image processing so we wanted to check out some of Julias image processing packages. Before you can install packages though, you have to import the package packager!Julia> using Pkg Julia> Pkg.add("Images") Julia> Pkg.add("ImageFiltering")
Those commands will download the packages. For some packages we also had to call Pkg.build before we could use them. Once we had all packages we needed we could import them, which means compiling them before you can use them. As a test image we choose what came up when we typed ‘Pandas’ into google image search.
What we like about tools like ipython is that you can interactivly check docstrings of functions and packages as you work with them. An interesting filter in imageprocessing is the gabor filter. We knew that the image filter package contained an implementation of the gabor filter but we didn’t know how to use it. With Julia you can type a ‘?’ to get into help mode. Then you can simply type any funcion you want and get its doc strings:
Now there was nothing in our way to use the gabor filter and save our result:
Julia> using Images Julia> using ImageFiltering Julia> img = load("pandas.jpg")
What we like about tools like ipython is that you can interactivly check docstrings of functions and packages as you work with them. An interesting filter in imageprocessing is the gabor filter. We knew that the image filter package contained an implementation of the gabor filter but we didn’t know how to use it. With Julia you can type a ‘?’ to get into help mode. Then you can simply type any funcion you want and get its doc strings:
Julia>?Kernel.gabor gabor(size_x,size_y,σ,θ,λ,γ,ψ) -> (k_real,k_complex) Returns a 2 Dimensional Complex Gabor kernel contained in a tuple where • size_x, size_y denote the size of the kernel • σ denotes the standard deviation of the Gaussian envelope • θ represents the orientation of the normal to the parallel stripes of a Gabor function • λ represents the wavelength of the sinusoidal factor • γ is the spatial aspect ratio, and specifies the ellipticity of the support of the Gabor function • ψ is the phase offset #Citation N. Petkov and P. Kruizinga, “Computational models of visual neurons specialised in the detection of periodic and aperiodic oriented visual stimuli: bar and grating cells,” Biological Cybernetics, vol. 76, no. 2, pp. 83–96, Feb. 1997. doi.org/10.1007/s004220050323
Now there was nothing in our way to use the gabor filter and save our result:

Keine Kommentare:
Kommentar veröffentlichen