How to stretch an image by a factor along the horizontal axis?

59 ビュー (過去 30 日間)
Peter
Peter 2012 年 10 月 18 日
Hi everyone,
I'm trying to compensate for projection effects that happened during the off axis recording of an image. The result is an elliptic projection instead of a regular circle. So I'm looking for a way to stretch that image along the horizontal axis by a certain factor. How can this be done? Any advice is appreciated. Thanks.

採用された回答

Image Analyst
Image Analyst 2012 年 10 月 18 日
編集済み: Image Analyst 2012 年 10 月 18 日
Sure, just send in a new XData property to imshow:
grayImage = imread('moon.tif');
[rows columns numberOfColorChannels] = size(grayImage);
subplot(2, 1, 1);
imshow(grayImage);
newWidth = [1 5 * columns]
subplot(2, 1, 2);
imshow(grayImage, 'XData', newWidth);
If you want to change the actual image itself, rather than just how it appears during display, then you can use imresize()
stretchedImage = imresize(grayImage, [rows newWidth]);
  1 件のコメント
Peter
Peter 2012 年 10 月 18 日
Thanks. So easy once you know how to. Will never forget :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by