Matlab_11b

Image Data

Here is a function that introduces image manipulation

function [grayIm, edgeIm] = edgesof(fname,threshold)

im = imread(fname);

grayIm = (0.2989 * double(im(:,:,1)) + 0.5870 * double(im(:,:,2)) + 0.1140 * double(im(:,:,3)))/255;

k = [1 2 1; 0 0 0; -1 -2 -1];

H = conv2(double(grayIm),k, 'same');

V = conv2(double(grayIm),k','same');

E = sqrt(H.*H + V.*V);

edgeIm = uint8((E > threshold) * 255);

end

The function uses a simple convolution method to filter out the edges of the objects in the picture