# language matlab

### Image Slicing Using MATLAB

MATLAB is an awesome tool for image processing and analysis; one feature that puts it head and shoulders above the rest is it’s ability to represent images as a matrix. With this capability we can leverage our knowledge of Linear Algebra and Calculus to do some pretty amazing things. This use of matrices also allows us to intuitively perform some simple functions such as cutting an image into multiple pieces.

To do this we first load an image into MATLAB using the imread command.

waldo = imread('http://www.findwaldo.com/fankit/graphics/IntlManOfLiterature/Scenes/AtTheBeach.jpg'); imshow(waldo);

To take just a block of the image for further analysis by either an image recognition algorithm, neural net, or some other function we would use this code.

imshow(waldo(50:100,50:90,:))

where imshow(xLbound : xUbound, yLbound : yUbound, : ) we take the entire row and column for the last parameter to preserve the colour of the image. See if you can identify where the slice came from. 🙂

### Introduction To MathWorks MATLAB

MathWorks MATLAB^{® }is a high-level language and interactive environment that enables you to perform computationally intensive tasks faster than with traditional programming languages such as C, C++, and Fortran. MATLAB allows for fast prototyping and testing of problems involving simulations, image processing, statistics, artificial intelligence and search/optimization requirements. These capabilities are provided by toolboxes such as Simulink, NN toolbox, Image Processing toolbox and Search/Optimization toolbox.

MATLAB is built on a foundation of matrices therefore all operations involve some form of matrix or vector manipulation, this makes it an ideal tool for use in Discrete Mathematics and Linear Algebra. MATLAB also comes packed with many common mathematical functions and operations, it also has the ability for easy graphing and display of data using generated reports.

function rtn = creator(option, state, flags) temp = floor(5.*rand(5,1)); % ; turn off echo to command window. rtn = temp';

Basic commands:

clc % clears command window clear % clears workspace window plot % displays the plot window

**MATLAB Cheat Sheet**

http://web.mit.edu/18.06/www/MATLAB/matlab-cheatsheet.pdf

**MATLAB Tutorials**

http://www.mathworks.com/products/matlab/?s_cid=global_nav