Ideas
Follow


It's time to retire and replace IMSHOW

Steve Eddins on 12 Dec 2024 (Edited on 13 Dec 2024)
Latest activity Edit by Royi Avital 13 minutes ago

Speaking as someone with 31+ years of experience developing and using imshow, I want to advocate for retiring and replacing it.
The function imshow has behaviors and defaults that were appropriate for the MATLAB and computer monitors of the 1990s, but which are not the best choice for most image display situations in today's MATLAB. Also, the 31 years have not been kind to the imshow code base. It is a glitchy, hard-to-maintain monster.
My new File Exchange function, imview, illustrates the kind of changes that I think should be made. The function imview is a much better MATLAB graphics citizen and produces higher quality image display by default, and it dispenses with the whole fraught business of trying to resize the containing figure. Although this is an initial release that does not yet support all the useful options that imshow does, it does enough that I am prepared to stop using imshow in my own work.
The Image Processing Toolbox team has just introduced in R2024b a new image viewer called imageshow, but that image viewer is created in a special-purpose window. It does not satisfy the need for an image display function that works well with the axes and figure objects of the traditional MATLAB graphics system.
I have published a blog post today that describes all this in more detail. I'd be interested to hear what other people think.
Note: Yes, I know there is an Image Processing Toolbox function called imview. That one is a stub for an old toolbox capability that was removed something like 15+ years ago. The only thing the toolbox imview function does now is call error. I have just submitted a support request to MathWorks to remove this old stub.
Royi Avital
Royi Avital about 2 hours ago (Edited 13 minutes ago)
I was long after a simple function to show the image in 1:1 pixel ratio on a simple axes. It seems your function can do that which is great!
Steve Eddins
Steve Eddins 27 minutes ago (Edited 25 minutes ago)
I probably wouldn't call imview a "simple" function, Royi. 🙂 It has more complicated behavior than imshow in some ways, particularly regarding interpolation and the use of a pixel grid at very high zoom levels. Also, I'm currently working on adding a way to display and directly manipulate the zoom level, which imshow does not have.
But with respect to figure resizing and axes interaction, imview is definitely simpler than imshow, by design. It does not resize the figure, and it gets the axes to plot in just by calling newplot. That means that its behavior regarding creating or reusing or resetting figures and axes should be the same as other high-level graphics plotting functions.
I expect to release an imview update soon. The new version will remove most of the limitations with respect to imview, and it will add the zoom-level control.
Royi Avital
Royi Avital 13 minutes ago
Hi,
Meant "simple" from the user point of view, not the implementation :-).
Steve Eddins
Steve Eddins on 12 Dec 2024
I have just made a fix to my File Exchange submission and bumped the version to 1.0.3. I needed to initialize the image interpolation method earlier to get good results in the MATLAB Editor.
Michelle Hirsch
Michelle Hirsch on 12 Dec 2024
I've entered an enhancement request on your behalf 😊
Steve Eddins
Steve Eddins on 12 Dec 2024
Thank you, Michelle!

Tags

No tags entered yet.