Contents for Lecture 5• Plotting capabilities in Matlab• Digital images and their construction• Image processing
Matlab offers a rich graphicsenvironment and even if you do notfeel comfortable programming inMatlab you should make use of itsgraphics capabilities as it will allowyou to produce much higher qualitygraphs and figures than is possiblein Excel, for example.
The most basic function you can use is togenerate scatterplots.Imagine that you have an array of data where thefirst column contains the year (1985-2010) inwhich a sample was taken and the second issome property of that sample.A basic piece of exploratory data analysis wouldbe to plot these data against one another.
The Matlab command is “plot”i.e.plot(Data(:,1),Data(:,2))This defaults to producing a solid line in blue
plot(Data(:,1),Data(:,2))We can make use of a shorthand for line symbols,line colours and line types to vary this. Someexamples:Colours Types Symbolsb = blue - = solid line o = circlesr = red : = dotted s = squarek = black -- = dashed d = diamondg = green ^ = triangle
Images may also be displayed using the “image”or “imagesc” commands.Hopefully the previous example has highlightedthat an image is simply an array of digitalnumbers.This example was coloured but it was a “falsecolour” image. There was only level to the arrayand the colouring was applied in bands:high values (peaks) in red; low values (troughs) inblue.It might as well be a grey-scale image and we canmake it so by changing the “colormap”.
A “true colour” image (like a jpeg file) isconstructed rather differently. Instead of a singlelayer to the array, it has layers for each colour:Three layers for an RGB imageFour for a CMYK imageEach layer ranges from 0 to 255 and tells you howred or green or blue the colour is at that point.When they are all combined they give you thecolour at that location, which using a legend, youcan relate to properties of the image.
Colour maps in Matlab by default range from 0 to63.The “image” command displays an image literallyrelating the values in the array to the colour map.The “imagesc” command rescales the values inthe array so that they fit the colour map.For example, the values in our image go from 0-255 so using “image” we would expect about 75%of the image to wash out as white
Matlab provides a flexible tool for producinggraphics.This includes images, which are simply arrays ofnumbers (1 layer for grey-scale, more for truecolour).Image processing is an important area ofengineering science:Stress analysis on beams using photostresssystems;Particle Imaging velocimetry;Monitoring of land use change using remotesensing;Face or fingerprint recognition software, etc.
The Coursework Sobel Filtering – Edge Detection