Hi,
please want to zoom my image; How can i do please?
I done this code:
load navatalungo_H.asc
NP1 = 1151;
xx=linspace(0,0.02*(NP1-1),NP1);
imagesc(xx,t,navatalungo_H')

 採用された回答

Walter Roberson
Walter Roberson 2017 年 11 月 3 日

0 投票

You can generally turn zoom on or off or set a zoom factor using zoom()
However, if you want to zoom to a particular section then the easiest way is to set the axes xlim and ylim . When you do this you should take into account that the xx and t coordinates are the coordinates of the centers of pixels, so you would want to nudge the limits a little to the left or right to include whole pixels.
Note: when you pass x and y values to image() or imagesc() or imshow(), then only the first and last values are paid attention to. If you need a non-linear presentation of an image you need to handle it a different way, such as using pcolor(), or texture mapping your image onto a surface or patch.

11 件のコメント

denis bertin
denis bertin 2017 年 11 月 3 日
my image look like this, I just want to zoom the header.
Walter Roberson
Walter Roberson 2017 年 11 月 3 日
After displaying the image, experiment with
YL = get(gca, 'ylim')
Ylim_at_top = [YL(2) - (YL(2)-YL(1))/6, YL(2)]
set(gca, 'YLim', Ylim_at_top)
pause
Ylim_at_bottom = [YL(1), YL(1) + (YL(2)-YL(1))/6];
set(gca, 'YLim', Ylim_at_bottom)
pause
and see if one of the two does what you want
denis bertin
denis bertin 2017 年 11 月 3 日
Many Thank, it is exactly what i need.
Walter Roberson
Walter Roberson 2017 年 11 月 3 日
Which one turned out to be the one you wanted?
denis bertin
denis bertin 2017 年 11 月 3 日
The second. Ylim_at_bottom = [YL(1), YL(1) + (YL(2)-YL(1))/6]; set(gca, 'YLim', Ylim_at_bottom)
But i want to have the '/6' value dynamicly... Why have you divide by 6 please? not another number may be...
Walter Roberson
Walter Roberson 2017 年 11 月 3 日
編集済み: Walter Roberson 2017 年 11 月 4 日
I did a visual examination and saw that the interesting information appeared to be between 0 and 0.2. When I looked at the tick marks and the width of the borders, it appears to me that the tick marks are about 1/12 of the height of the image (including borders). One tick plus keeping the border is about 1/12+1/12 = 1/6 of the height.
For anything dynamic you would need to have some way of calculating what part of the image was "interesting" to zoom into.
denis bertin
denis bertin 2017 年 11 月 4 日
編集済み: denis bertin 2017 年 11 月 4 日
Thank you... Is it possible having 'grey' background color please?
Walter Roberson
Walter Roberson 2017 年 11 月 4 日
I am not sure what you are asking about grey background. You can
set(gca, 'Color', [.1 .1 .1])
to get 1/10th intensity as the background. This will be visible only in the parts of the axes where nothing is drawn, but if you are zooming in using ylim then everything is going to be drawn on (unless you set the data aspect ratio somehow, such as "axis equal")
denis bertin
denis bertin 2017 年 11 月 4 日
編集済み: denis bertin 2017 年 11 月 4 日
Hi, If you look the picture, background color was blu, i want it grey color.
After display image, i put this:
YL = get(gca, 'ylim') Ylim_at_bottom = [YL(1), YL(1) + (YL(2)-YL(1))/2.5];
set(gca, 'YLim', Ylim_at_bottom) set(gca, 'Color', [.1 .1 .1])
but i always have blu background color(see attach).
Walter Roberson
Walter Roberson 2017 年 11 月 4 日
If you look at Cattur1.PNG that you posted first, the background color is white and the content of the image happens to be mostly blue. I think the blue is your image, not background.
denis bertin
denis bertin 2017 年 11 月 5 日
Yes! it's true. Sorry, i would want grey image.
Thank you...

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2017 年 11 月 4 日

2 投票

See attached zoom demo, given to me by the Mathworks.

3 件のコメント

Stephen Devlin
Stephen Devlin 2018 年 5 月 15 日
Thank you Image Analyst, this is brilliant!
Bang bang
Bang bang 2020 年 2 月 11 日
How can I contact you Image Analyst I have a lot of question for you
Walter Roberson
Walter Roberson 2020 年 2 月 11 日
You can create Questions in MATLAB Answers.
Image Analyst does not accept private correspondence.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by