sramij
sramij

Reputation: 4925

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?

Upvotes: 2

Views: 477

Answers (1)

Przemyslaw Szufel
Przemyslaw Szufel

Reputation: 42214

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

Upvotes: 2

Related Questions