MATLAB:以原始大小显示图像 [英] MATLAB: Display an image in Its Original Size

查看:1594
本文介绍了MATLAB:以原始大小显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在MATLAB中以原始大小显示图像吗?

Can we show an image in its original size in MATLAB?

现在我们正在显示时,它完全适合图像窗口大小。但是,我想以原始大小显示图像。当图像尺寸较大时,图像窗口中应出现滚动条。这将允许用户以其原始大小查看图像。

Right now when we are showing, it is exactly fitted to the image window size. However, I want to show the image in its original size. When the image is of larger size, a scroll bar should appear in the image window. This would allow the user to view the image in its original size.

有关如何实现这一目标的任何想法?这可能吗?

Any ideas on how to achieve this? Is this possible?

推荐答案

我相信你要找的是 IMTOOL 实用程序(它是图像处理工具箱)。它是一个MATLAB GUI,允许您使用水平和垂直滑块以原始大小(100%放大率)查看图像。

I believe what you're looking for is the IMTOOL utility (which is a part of the Image Processing Toolbox). It's a MATLAB GUI that allows you to view images in their original size (100% magnification) with horizontal and vertical sliders.

编辑:

上述解决方案将在新的图形窗口(IMTOOL GUI)中显示您的图像。如果您不希望图像出现在新窗口中,而是想要在自己的窗口中调整其大小,则会更加困难。要调整图像的大小,我假设您已使用 IMAGE 命令,你必须调整一些轴属性。以下是您可能最终修改的属性:

The above solution will display your image in a new figure window (the IMTOOL GUI). If you don't want the image appearing in a new window, but instead want to adjust its size in a window of your own, it will be more difficult. To adjust the size of the image, which I assume you've displayed on a set of axes using the IMAGE command, you will have to adjust a number of axes properties for the axes containing the image. The following are the properties you will likely end up modifying:


  • 'Units' :这可以设置为'inches''厘米''pixels' ,例如。

  • 'Position':它控制轴在图窗口中的放置位置,以'单位'属性为单位的单位。

  • 'DataAspectRatio'/'PlotBoxAspectRatio':它们控制轴和周围绘图框的相对比例。

  • 'XLim'/'YLim':轴的最小值和最大值。

  • 'Units': This can be set to 'inches', 'centimeters', or 'pixels', for example.
  • 'Position': This controls where the axes are placed in the figure window, in units governed by the 'Units' property.
  • 'DataAspectRatio'/'PlotBoxAspectRatio': These control the relative scaling of the axes and the surrounding plot box.
  • 'XLim'/'YLim': The minimum and maximum values of the axes.

获取图像的大小和缩放以显示您想要的方式后,图像的一部分可能在图窗口区域之外。不幸的是,水平和垂直滑块不会自动添加。您必须使用 UICONTROL 功能。您必须为滑块控件编写回调函数,以便它们在窗口中移动轴。

After getting the size and scaling of the image to display the way you want, parts of the image could be outside the figure window area. Unfortunately, horizontal and vertical sliders will not be automatically added. You will have to create these slider controls yourself using the UICONTROL function. You will have to write the callback functions for the slider controls such that they move the axes around in the window.

如果您选择沿着上述路径冒险,这里是一些指向GUI设计教程的链接可以帮助您:关于blinkdagger的滑块教程 Doug Hull的博客文章 Doug关于GUIDE基础知识的视频

If you choose to venture down the above path, here are a few links to GUI design tutorials that may help you: a slider tutorial on blinkdagger, a blog post by Doug Hull, and a video from Doug on GUIDE basics.

这篇关于MATLAB:以原始大小显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆