MATLAB Answers

0

How to get image of figure with exact same size after saving on computer

Rafi Ahmed 님이 질문을 제출함. 22 Sep 2019
최근 활동 Rafi Ahmed 님이 편집함. 25 Sep 2019
I would like to save image from a figure with exact same size. I have used export setup for specific size (e.g. points) of image. However, it becomes a different dimension after saving on computer memory. Is there any way to get the image of that figure with exact same size after saving it.

  댓글 수: 0

로그인 to comment.

답변 수: 1

Image Analyst 님의 답변 22 Sep 2019

Using saveas() or export_fig() will give you an image the same size in pixels as the displayed figure.
If you have an axes on that figure and want just the stuff in the axes, you can use getimage() or getframe() to get an image.
If you have an image, you can use imwrite() and that will save it with the same size.

  댓글 수: 8

표시 이전 댓글 수: 5
Sir,
Thanks for your comment. I could not understand the procedure. Would you please explain the process of linearizing the values?
You have
[Az Doppler] = meshgrid(sin(phi*pi/180),fdop);
so Az will be "sin spaced" apart -- closer together near -180, 0, and +180 than near +-90 degrees. When you then use Az as the x coordinate for pcolor, it has to put the elements closer together or further apart because of that.The distance between adjacent values is not constant with what you are doing now. But when you create an image, the distance between adjacent values (pixels) is constant. So you have to substitute in original non-linearly spaced phi coordinates such that sin() of them translates after the sin() to be linearly spaced.
However, I just realized that you have a problem: for each x value in the range (-1,1) exclusive, there are two phi values that map to that same x value. Your surface folds back on itself, and you need to decide which of the folds is the one that you want to appear in the output.
Sir,
Yes you are right. The values fold back and I need all of them in one image. I guess, there is no option but to use pcolor for that. But I could not understand that if I have the figure, why couldn't I save the figure with the size of 360x360 dimension? It is always converted into another dimension (e.g. 525x700) when saving on computer memory. When I resize it to 360x360, it has some loss probably. Do you think that, resizing image has better solution?

로그인 to comment.



Translated by