Display imagesc within a shape

Hi! I have a matrix of values that refer to the stress on a trapezoidal shape. Now, I would like to show the intensity of the stresses on the shape. If I use imagesc, I can see the stresses on a square... How could I reshape imagesc to fit my trapezoidal shape?
Thank you.

 採用された回答

Alessandro Masullo
Alessandro Masullo 2012 年 10 月 20 日

0 投票

The problem is that my matrix is rectangular shape, but it refers to a trapezoidal shape, so I should reshape the content of the matrix to fit the shape. The function I would like to use is is a sort of "area()" with the content of imagesc().

6 件のコメント

Walter Roberson
Walter Roberson 2012 年 10 月 20 日
編集済み: Walter Roberson 2012 年 10 月 20 日
reshape() cannot change the shape of a rectangular matrix to trapezoidal. MATLAB does not have any storage mechanism or display mechanism for trapezoidal arrays. Traditional pixel displays cannot display trapezoidal shapes without getting the edges wrong. It has been decades since I last used a real vector display (non-pixel) device.
Image Analyst
Image Analyst 2012 年 10 月 20 日
Would imtransform() work for you? You could take your matrix and warp it into a trapezoidal shape on a rectangular canvass, with the canvass being black in the background where there is no shape.
Alessandro Masullo
Alessandro Masullo 2012 年 10 月 20 日
@Image Analyst, This is what I was looking for!!! Thank you so much!
Alessandro Masullo
Alessandro Masullo 2012 年 10 月 20 日
But... how can I use imtransform on imagesc? It wants an imread as input...
Image Analyst
Image Analyst 2012 年 10 月 20 日
編集済み: Image Analyst 2012 年 10 月 20 日
No, you use imtransform on the image to create a new rectangular image just for display. Then use imagesc() for displaying it. (By the way you should have accepted my answer rather than yours.) Why don't you post your data/image so we can see what you're talking about?
Alessandro Masullo
Alessandro Masullo 2012 年 10 月 20 日
I would like to choose your answer, but your answer is a comment to my answer (that is a comment!)
However, I have this shape:
xW = [0 150 190 150 37 0];
yW = [0 0 0 42 60 60];
area(xW, yW)
I have done some calculations on this area (it's a wing) considering it section by section, each section of the same length, because length doesn't effect these calculations. The result of these calculations is, as expected, a rectangular matrix. Now I would transform the imagesc() of this matrix to fit the initial area.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2012 年 10 月 19 日

0 投票

Axes must be rectangular. imagesc() uses some arbitrary colormap. If your stresses are zero outside the trapezoid and show up as blue, you could use a different colormap - one that had zero being black or the same gray as the rest of your figure if you didn't want the zeros to show up as blue.

カテゴリ

ヘルプ センター および File ExchangeStress and Strain についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by