[julia] imshow() return a dict and no image in Visual Studio Code

Hello dear community,

I’m running this code in a jupyter notebook via Visual Studio Code:

# Packages
using Images, ImageView
# Loading image from path
img_rgb = load(img_path)
# Compound function converting img to gray then to an array of float64
img = Gray.(img_rgb) |> (s -> convert(Array{Float64},s))
# Displaying the result
imshow(img)

willing to display the matrix as an image. However, the imshow() function return a Dict in the output cell, and no image:

Dict{String, Any} with 4 entries:
  "gui"         => Dict{String, Any}("window"=>GtkWindowLeaf(Ptr{GObject} @0x00…
  "roi"         => Dict{String, Any}("redraw"=>ObserverFunction[ObserverFunctio…
  "annotations" => Observable(Dict{UInt64, Any}())
  "clim"        => Observable(CLim{Float64}(0.0980392, 0.960784))

Any idea why ? Do I miss a package to correctly display the img ?

Thank you in advance !

IIRC, this should display directly in the notebook, without calling imshow, and without converting to an array. For example:

imshow is supposed to open up a separate window, not show things inside a notebook. (Maybe it is opening a window somewhere you haven’t noticed?)

Indeed, it does display the image, but Gray.() output typeof is RGB{N0f8}. So, I convert to an Array{Float64} so I can process FFTs and stuff.
However, once my image is Array{Float64}, the plot() function displays each rows as a signal:


That’s why I tried to use imshow().

Also, there is indeed a popup window appearing, but it’s blank and makes Julia crashes every time I clic on it:

If you want to use Plots.jl, you can use heatmap(array, c=:grays).

File an issue with ImageView.jl

1 Like

Okay, thank you !