MATLAB: Отобразите изображение в Его Первоначальном размере

Существуют некоторые подобные потоки, если Вы ищете их, но basicly, к чему это сводится, - то, что, если Вы хотите к RAII на.NET просто, реализуют тип IDisposable и используют оператор "использования" для получения детерминированного Распоряжения. Тем путем многие из тех же идиом могут реализовываться и использоваться только немного более многословным способом.

7
задан Royi 14 April 2018 в 07:47
поделиться

2 ответа

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.

EDIT:

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': 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.

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.

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.

8
ответ дан 6 December 2019 в 19:39
поделиться

У слайдера Matlab есть проблема, заключающаяся в том, что он запускает обратный вызов только на MouseUp, а не на MouseMove, поэтому чистая реализация Matlab всегда будет казаться странной.

Лучший способ - перейти на Java в Matlab. Таким образом, вам не нужно заново реализовывать всю логику прокрутки. Вы можете поместить компонент Java Swing GUI в окно Matlab, это совсем несложно.

В частности, вы должны использовать Swing ​​JScrollPane Class. С помощью функции Matlab javacomponent () вы можете поместить ее в окно Matlab.

В Интернете есть масса примеров того, как получить изображение в области прокрутки, просто найдите JScrollPane image ]. Вы можете использовать классы Java внутри Matlab с обычным синтаксисом Matlab (нет необходимости в ключевом слове new и т. Д.)

2
ответ дан 6 December 2019 в 19:39
поделиться
Другие вопросы по тегам:

Похожие вопросы: