ImageView very slow

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

ImageView very slow

Paul B.
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?
Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Páll Haraldsson
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?

Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Tim Holy
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

Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Paul B.
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.
Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Tim Holy
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.

On Tue, Oct 25, 2016 at 5:24 PM, Paul B. <[hidden email]> wrote:
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.

Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Josef Heinen
In reply to this post by Paul B.
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.



On Sunday, October 16, 2016 at 6:45:00 PM UTC+2, Paul B. wrote:
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?
Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Tom Breloff
And of course you can always plot an image as well:

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

On Wed, Oct 26, 2016 at 11:04 AM, Josef Heinen <[hidden email]> wrote:
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.



On Sunday, October 16, 2016 at 6:45:00 PM UTC+2, Paul B. wrote:
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?

Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Josef Heinen
... which looks more convenient :-)

On Wednesday, October 26, 2016 at 5:21:01 PM UTC+2, Tom Breloff wrote:
And of course you can always plot an image as well:

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

Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Paul B.
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!
Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Tom Breloff
You're looking for "heatmap". You should read the docs if you want to learn more. 

On Wednesday, October 26, 2016, Paul B. <[hidden email]> wrote:
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!
Reply | Threaded
Open this post in threaded view
|

Re: ImageView very slow

Josef Heinen
In reply to this post by Paul B.
Paul: Would be helpful to see the real data (file) you want to visualize and the plot you are expecting.