juliaijulia-notebook

How to load raw binary array data into Julia and display it?


I would like to load a raw image data (such as the .raw ones from http://eeweb.poly.edu/~yao/EL5123/SampleData.html) into Julia and display them. Basically, I am looking for a way to load file into Julia as Array{xxx} type.

Any ideas?


Solution

  • Here is the code and along with the resulting plot:

    using Plots, Images, HTTP
    r = HTTP.request("GET", "http://eeweb.poly.edu/%7Eyao/EL5123/image/lena_gray.raw")
    img = reshape(r.body, 512, 512)
    v = rotr90(colorview(Gray, img./256));
    Plots.plot(v)
    savefig("lena.png")
    

    enter image description here