ImageView very slow

250 views
Skip to first unread message

Paul B.

unread,
Oct 16, 2016, 12:45:00 PM10/16/16
to julia-users
Hello, all.  Starting out with Julia.

I need to display some pseudo-color images so I'm playing around with the ImageView package.  It seems to be running very slowly.  Displaying one of the images from TestImages can take nearly a minute:
img = testimage( "cameraman" )
Gray Images.Image with:
  data
: 512×512 Array{ColorTypes.Gray{FixedPointNumbers.UFixed{UInt8,8}},2}
  properties
:
    colorspace
: Gray
    spatialorder
:  x y

julia
> tic(); ImageView.view( img ); toc();
elapsed time
: 50.552471225 seconds
Zooming and other interaction with the mouse is similarly sluggish.

I didn't expect this for a 512x512 grayscale image.  I am running Julia version 0.5.1-pre+2 and ImageView is running into some issues with deprecated functionality and namespace conflicts.  However, the above did not generate any warnings at all but still took 50 seconds to display.  This is all under Linux.  Any ideas why this is happening or if I could be doing something wrong?

Páll Haraldsson

unread,
Oct 16, 2016, 3:26:35 PM10/16/16
to julia-users
On Sunday, October 16, 2016 at 4:45:00 PM UTC, Paul B. wrote:
into some issues with deprecated functionality

I think they can make slower, not sure if by this much.

I see: "fix julia 0.5 deprecations       19 days ago"

Maybe if you update the package this will be ok?

Tim Holy

unread,
Oct 16, 2016, 9:09:57 PM10/16/16
to julia...@googlegroups.com
Hmm, I fixed this on the images-next branch but forgot to fix it on master. Will be fixed in https://github.com/timholy/Images.jl/pull/564.

If you're just getting started with Julia & Images, you might want to consider using the upcoming version of Images. See https://github.com/timholy/Images.jl/issues/542#issuecomment-254059092.

Best,
--Tim

Paul B.

unread,
Oct 25, 2016, 6:24:48 PM10/25/16
to julia-users
Tim, when you say you fixed this, you mean the deprecation warnings?  I'll definitely use the new version of Images.  I haven't had a chance yet since posting this.  Images and related libraries look great.

The graphics functionality in Julia that deal with bitmaps like ImageView and pcolor in PyPlot seem slow.  I'm used to imagesc in MATLAB which can be unresponsive for very large images but not quite as sluggish as what I've been seeing.  From what little I found, it sounds like a lot of these use Tk which is controlled through text commands.  Am I mistaken?  Is there something maybe simpler but quicker than ImageView that will display a pseudo-color image?  Otherwise I might just bang something up that uses Images to save a PNG file then calls an external viewer to display it.

Tim Holy

unread,
Oct 25, 2016, 9:28:13 PM10/25/16
to julia...@googlegroups.com
Yes, it should be pretty responsive now---ImageView doesn't have to go through a Python layer, so I think it's a bit snappier. It's been a while since I've used Matlab, but at least when I first compared them ImageView was considerably better than Matlab for interactive display of movies, etc. But Tk does have pretty significant limitations; now that the Images rewrite is largely done I'm planning to rewrite ImageView using Gtk. Not started yet, though.

Josef Heinen

unread,
Oct 26, 2016, 11:04:28 AM10/26/16
to julia-users
Using GR (for the image display) should be fast enough:

using TestImages
using GR

img
= testimage("cameraman")
intensities
= reshape(reshape(float(img.data[:]), 512, 512)

for i in 1:10
    tic
(); imshow(intensities, colormap=GR.COLORMAP_GRAY); toc()
end


% julia img.jl 

elapsed time: 1.190862896 seconds

elapsed time: 0.007231715 seconds

elapsed time: 0.013265573 seconds

elapsed time: 0.00677057 seconds

elapsed time: 0.012534283 seconds

elapsed time: 0.010761427 seconds

elapsed time: 0.00731559 seconds

elapsed time: 0.009606974 seconds

elapsed time: 0.007050752 seconds

elapsed time: 0.008927604 seconds


The first call is slower because the window has to be set up.

Tom Breloff

unread,
Oct 26, 2016, 11:21:01 AM10/26/16
to julia-users
And of course you can always plot an image as well:

using Plots, TestImages
plot(testimage("cameraman"))

Josef Heinen

unread,
Oct 26, 2016, 11:30:00 AM10/26/16
to julia-users
... which looks more convenient :-)

Paul B.

unread,
Oct 26, 2016, 8:57:13 PM10/26/16
to julia-users
Tim:  Thank you, that works great.

Josef:  I can plot 2D matrices with GR (which is what I want) but your code example doesn't work.  GR looks pretty impressive, I'll have to check it out.  A bit disappointed there's no interface to zoom in/out with the mouse and for some reason the window won't close.

Tom:  Works for images but not readily clear how to plot something like rand(100,100) as a bitmap instead of a 100 lines.  Do I have to convert it to an image structure for plot to figure out that it's a bitmap?

Thanks, all!

Tom Breloff

unread,
Oct 26, 2016, 11:25:48 PM10/26/16
to julia...@googlegroups.com
You're looking for "heatmap". You should read the docs if you want to learn more. 

Josef Heinen

unread,
Oct 27, 2016, 4:50:56 AM10/27/16
to julia-users
Paul: Would be helpful to see the real data (file) you want to visualize and the plot you are expecting.

Reply all
Reply to author
Forward
0 new messages