MATLAB Answers

How do I change the resolution of an image produced by imagesc?

68 views (last 30 days)
Ross Brain
Ross Brain on 10 Apr 2015
Commented: Ross Brain on 11 Apr 2015
How can I change the resolution of the image part of the figure produced by imagesc? I was going to try using imresize but I can't figure out how to make it work. I'm trying to purposefully reduce the quality of a data set as part of a simulation.

  1 Comment

Ross Brain
Ross Brain on 11 Apr 2015
For those curious what I'm doing, I'm using data from the Leiden/Dwingeloo sky survey of galactic neutral hydrogen to predict the output of the little SRT we have at the university but there's a resolution difference. The data straight from the survey looks like:
And the data from our SRT (I didn't take it, I know it's awful) looks like:
So with some blurring and now successfully having compressed the image to the same resolution, my simulation looks like:
Still obviously some work to go, but it may interest some.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 10 Apr 2015
If you use imresize() to shrink your image, but it is still bigger than the axes on your screen (for example a 500 by 700 image is being shown on 200 by 300 pixels on your screen, then you will not notice any difference upon display, but you will if you look at the actual variable in the variable inspector. Is that what is happening?
See my Zoom demo, attached. Actually it's an adapted demo personally given to me by the imaging team at the Mathworks.

  1 Comment

Ross Brain
Ross Brain on 11 Apr 2015
I worked out my own mistake. I didn't realise that I could just use imresize on the matrix I was putting into imagesc. For info on what I was trying to do look at my own comment under the question.

Sign in to comment.

More Answers (1)

Chris McComb
Chris McComb on 10 Apr 2015
To use imresize, you first read the image in:
a = imread('image.jpg');
Then, you apply imresize as follows (for example to reduce resolution by 50%):
b = imresize(a, 0.5);
Your reduced image is stored to b.

  1 Comment

Ross Brain
Ross Brain on 11 Apr 2015
My image is stored as an array, which I use imagesc to visualise. This is the image I need to resize so it's not stored anywhere to load in.

Sign in to comment.