このページの翻訳は最新ではありません。ここをクリックして、英語の最新版を参照してください。
大きいイメージのナビゲーション用アプリの作成
この例では、モジュラー ツールを使用して、スクロール バー、概要ウィンドウ、倍率ボックスなどのナビゲーション支援ツールと共にイメージを表示するアプリを作成する方法を説明します。
まず、アプリを作成する関数を定義します。この例では、my_large_image_display
と呼ばれる関数を、例の最後に定義します。
アプリを作成する関数を定義した後、このアプリをテストします。イメージをワークスペースに読み取ります。
I = imread('car1.jpg');
アプリ内のナビゲーション支援ツールでイメージを表示します。
my_large_image_display(I)
アプリ作成関数
関数 my_large_image_display
は、イメージを引数として受け入れ、スクロール バー、概要ツールおよび倍率ボックスと共に Figure ウィンドウにイメージを表示します。スクロール可能なナビゲーションは標準の MATLAB™ Figure ウィンドウのナビゲーション ツールとの互換性がないため、この関数は Figure ウィンドウのツール バーとメニュー バーを表示しないことに注意してください。
function my_large_image_display(im) % Create a figure without toolbar and menubar hfig = figure('Toolbar','none', ... 'Menubar','none', ... 'Name','My Large Image Display Tool', ... 'NumberTitle','off', ... 'IntegerHandle','off'); % Display the image in a figure with imshow himage = imshow(im); % Add the scroll panel hpanel = imscrollpanel(hfig,himage); % Position the scroll panel to accommodate the other tools set(hpanel,'Units','normalized','Position',[0 .1 1 .9]); % Add the magnification box hMagBox = immagbox(hfig,himage); % Position the magnification box pos = get(hMagBox,'Position'); set(hMagBox,'Position',[0 0 pos(3) pos(4)]); % Add the Overview tool hovervw = imoverview(himage); end
参考
imscrollpanel
| immagbox
| imoverview