Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
load image resolution decreased, draw flowchart

Subject: load image resolution decreased, draw flowchart

From: leo nidas

Date: 25 Sep, 2011 10:36:11

Message: 1 of 10


Hi there,

I have some basic questions about loading images in MATLAB.

I have no idea about image processing at all. In fact the only thing I know is that there some types of images such .png, jpeg etc.

So I used a free software paint.net to draw a simple graph, some circles with some text inside (just playing around trying to draw a flowchart).

Now I save this image as png (also tried as jpg) and when I double click it to open it again I happy with the resolution. (The name of the file )

I want to load this image to matlab for further manipulation, (or save it as an eps) and type

close all
clear all
clc
rgb = imread('algo.png');
image(rgb);
axis off
axis image

and the image is loaded but I cannot say I am satisfied with the resolution, it is ruined.. The circles appear not so smooth as in the original image, the seem a bit jagged (so is the text)

 It is sure that I may be missing dosen of things. Is there a way to increase the resolution of the image loaded so as to appear as the original one?

When I type whos I get
Name Size Bytes Class Attributes

  rgb 600x800x3 1440000 uint8

if this is of any help..


Another question is, can I use MATLAB to draw a flowchart with all the circles and rhombus and text on the arrows etc? An example would be appreciated.

And another question is how can one load an image that is in pdf format in MATLAB?

Thanks in advance for any answers! Please try to be simple! It's the first time I am trying to do this image kind of stuff!

Thanx again!

Subject: load image resolution decreased, draw flowchart

From: Abbas Cheddad

Date: 25 Sep, 2011 13:22:07

Message: 2 of 10

Use imshow instead of image.

rgb = imread('algo.png');
imshow(rgb);
%axis off
%axis image

Your 2nd question
Bar and Area Graphs
http://www.mathworks.se/help/techdoc/creating_plots/f10-19972.html

Pie Charts
http://www.mathworks.se/help/techdoc/creating_plots/f10-1092.html


Your 3rd question
As far as I know Matlab can read/write .pdf as files. Your image is embedded into the .pdf file I presume?

Abbas

Subject: load image resolution decreased, draw flowchart

From: leo nidas

Date: 25 Sep, 2011 14:30:12

Message: 3 of 10

"Abbas Cheddad" <cheddad10NOSPAM@yahoo.com> wrote in message <j5n9tv$4fc$1@newscl01ah.mathworks.com>...
> Use imshow instead of image.
>
> rgb = imread('algo.png');
> imshow(rgb);
> %axis off
> %axis image
>
> Your 2nd question
> Bar and Area Graphs
> http://www.mathworks.se/help/techdoc/creating_plots/f10-19972.html
>
> Pie Charts
> http://www.mathworks.se/help/techdoc/creating_plots/f10-1092.html
>
>
> Your 3rd question
> As far as I know Matlab can read/write .pdf as files. Your image is embedded into the .pdf file I presume?
>
> Abbas




Thank you Abbas for your reply,

Using imshow still does not provide the visual quality that the original graph has..

I am not sure how the links you provided about Pie and bar charts can drive me through to draw a flowchart..

I would want something like this

http://en.wikipedia.org/wiki/Flowchart

to describe an algorithm (I don't care about colors, I use black white grey images)


I have no particular picture that is in pdf format. I just want to learn how can use MATLAB to load png or jpg format for further manipulation and then save them as eps witout any loss in terms of quality.

I noticed that imread does not support pdf formats (I would like to know in case I have an image in pdf format and wanted to do the same (i.e. load them in matlab and saving them as eps))


Any further suggestions are more than welcome!

Thanx again!

Subject: load image resolution decreased, draw flowchart

From: ImageAnalyst

Date: 25 Sep, 2011 14:35:45

Message: 4 of 10

Do you see any message int he command window that says something like
"the image is too big for display. It will be subsampled to fit"?
What might happen is that you are seeing the result of the image being
squeezed into a window that is not the same number of pixels as your
image, so it's subsampling or interpolating down to fit it in. Look
at the "InitialMagnification" setting of imshow(). Try setting it to
100 to do a pixel for pixel display.

Subject: load image resolution decreased, draw flowchart

From: ImageAnalyst

Date: 25 Sep, 2011 14:38:14

Message: 5 of 10

On Sep 25, 10:30 am, "leo nidas" <bleonida...@yahoo.gr> wrote:
> I just want to learn how can use MATLAB to load png or jpg format for further manipulation and then save them as eps witout any loss in terms of quality.
>
> I noticed that imread does not support pdf formats (I would like to know in case I have an image in pdf format and wanted to do the same (i.e. load them in matlab and saving them as eps))
-------------------------------------------------------------

See the FAQ:
http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.

export_fig saves in both pdf and eps, as well as a bunch of other
format. If it doesn't work, which happens occasionally but rarely,
then Oliver usually recommends changing your renderer.

Subject: load image resolution decreased, draw flowchart

From: Bruno Luong

Date: 25 Sep, 2011 14:42:10

Message: 6 of 10

"leo nidas" <bleonidas25@yahoo.gr> wrote in message
>
> I noticed that imread does not support pdf formats (I would like to know in case I have an image in pdf format and wanted to do the same (i.e. load them in matlab and saving them as eps))
>

postscript and pdf are mainly vectorized graphic documents, as soon as you convert in bitmap graphic such as png and jpg you definitively lost the original quality.

Bruno

Subject: load image resolution decreased, draw flowchart

From: Abbas Cheddad

Date: 25 Sep, 2011 14:57:08

Message: 7 of 10

Leo,

Imshow comes with some settings which you can manipulate to display the image as is without down-sampling (namely the 'InitialMagnification' argument).

I am very sorry, but I have no idea about constructing such Flow charts in Matlab,I doubt it has a function for that. Simulink does have a flow chart like programming environment but I think it is not what you want.

imread does not support files other than:
BMP — Windows Bitmap
JPEG — Joint Photographic Experts Group
PNG — Portable Network Graphics
CUR — Cursor File
JPEG 2000 — Joint Photographic Experts Group 2000
PPM — Portable Pixmap
GIF — Graphics Interchange Format
PBM — Portable Bitmap
RAS — Sun Raster
HDF4 — Hierarchical Data Format
PCX — Windows Paintbrush
TIFF — Tagged Image File Format
ICO — Icon File
PGM — Portable Graymap
XWD — X Window Dump


Abbas


"leo nidas" <bleonidas25@yahoo.gr> wrote in message <j5ndtk$hea$1@newscl01ah.mathworks.com>...
> "Abbas Cheddad" <cheddad10NOSPAM@yahoo.com> wrote in message <j5n9tv$4fc$1@newscl01ah.mathworks.com>...
> > Use imshow instead of image.
> >
> > rgb = imread('algo.png');
> > imshow(rgb);
> > %axis off
> > %axis image
> >
> > Your 2nd question
> > Bar and Area Graphs
> > http://www.mathworks.se/help/techdoc/creating_plots/f10-19972.html
> >
> > Pie Charts
> > http://www.mathworks.se/help/techdoc/creating_plots/f10-1092.html
> >
> >
> > Your 3rd question
> > As far as I know Matlab can read/write .pdf as files. Your image is embedded into the .pdf file I presume?
> >
> > Abbas
>
>
>
>
> Thank you Abbas for your reply,
>
> Using imshow still does not provide the visual quality that the original graph has..
>
> I am not sure how the links you provided about Pie and bar charts can drive me through to draw a flowchart..
>
> I would want something like this
>
> http://en.wikipedia.org/wiki/Flowchart
>
> to describe an algorithm (I don't care about colors, I use black white grey images)
>
>
> I have no particular picture that is in pdf format. I just want to learn how can use MATLAB to load png or jpg format for further manipulation and then save them as eps witout any loss in terms of quality.
>
> I noticed that imread does not support pdf formats (I would like to know in case I have an image in pdf format and wanted to do the same (i.e. load them in matlab and saving them as eps))
>
>
> Any further suggestions are more than welcome!
>
> Thanx again!

Subject: load image resolution decreased, draw flowchart

From: leo nidas

Date: 25 Sep, 2011 15:57:07

Message: 8 of 10

To ImageAnalyst

I tried what yousaid with 'InitialMagnification' set to 100 and I get a warning saying that it only can go up to 67%..

I think that this file for Filexchange has to do with exporting figures drawn in MATLAB in great analysis to presentations or documents etc.

I am very satisfied with the quality of figures that MATLAB provides me when I save a figure as an eps format in MATLAB and then use it in latex for example. That is for figures that are created within matlab. The problem is when I load one external image to MATLAB.

To Bruno Luong:

In my case I already have an image drawn with a different program that is in png (also hane one as jpg) and I am satisfied with what I see in the original image (which is already a bitmap graphic, so there is no conversion to bitmap as far as I understand..). I just load it to matlab but then the analysis is ruined (that is before I even save the new matlab figure)


Bruno, it is the first time I hear about all this, I was just googling to see what is a vectorized graphic or a bitmap that you said. So supposing that I want to draw an image with another program what file type do you suggest for saving before trying to load to MATLAB? There are some types available but no eps which is my ultimate purpose..



Really hope to understand what you all guys are saying and not just seem completely stupid, and asking for things you already have answered!

Thank you all for you answers!

Subject: load image resolution decreased, draw flowchart

From: Bruno Luong

Date: 25 Sep, 2011 16:20:14

Message: 9 of 10

"leo nidas" <bleonidas25@yahoo.gr> wrote in message <j5nj0j$4uj$1@newscl01ah.mathworks.com>...

>
> In my case I already have an image drawn with a different program that is in png (also hane one as jpg) and I am satisfied with what I see in the original image (which is already a bitmap graphic, so there is no conversion to bitmap as far as I understand..). I just load it to matlab but then the analysis is ruined (that is before I even save the new matlab figure)

AFAIK Matlab load does not change the resolution. How you are so sure the image is not degraded when it was saved/exported by other software?

Bruno

Subject: load image resolution decreased, draw flowchart

From: Abbas Cheddad

Date: 25 Sep, 2011 16:41:12

Message: 10 of 10

Have you tried exporting the image as .gif? GIF is ideal for art works. When reading it to MATLAB make sure to display that as:

imshow(image,colormap)
% When reading GIF files, MATLAB loads the data into a matrix called "cdata" and its
% indexed colors as colormap.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us