function out = emboss(in)
% EMBOSS Anisotropic edge enchaning/wiping.
% OUT = emboss(IN) returns the filtered signal OUT,
% given an input signal IN
% The result is an output signal where changes in intensity in the 90
% top-to-bottom direction have been enchanced (i.e. parallel horizontal
% lines) and all neighbouring same intensity areas brought to one
% value - the midpoint of the max-min values.
% Only images are supported (i.e. not matrices or vectors). Therefore
% the image should be loaded with imread(IN) prior to using emboss.
% 'Emboss' makes a negative image from the input signal, decals the
% positive signal in a given direction by a given step (by default
% 1 pixel in North > South direction), then sustracts the two layers.
% 'Emboss' filtering gives better results than 'Sobel' and 'Prewitt'
% if you want to enchance edges on one direction only.
% Emboss filtering can be used as an indicator to the speed in the
% change of intensity in various processes. Edge enchancement is just
% its application in Image Processing - edges are rapid changes of
% intensity in the spatial domain. But it could be used to other tasks.
% For example in mechanics recording the speed of an object in space,
% then passing the resulting vector through the 'emboss' filter, yields
% the coordonates where maximum accelerations occured.
% Possible developpements
% - direction of emboss (actually 90 = North > South)
% - decalage of positive and negative sheets (actually set to 1 pixel)
% - difference between min and max values (actually min = 0 & max = 1)
% - midpoint movable (actually set to half max - min)
% Formats supported:
% - unidimensional signals
% Vlad Atanasiu > 06/02/2002
% Revisions: 0 >
% makes negative image
neg = imadjust(in,,[1 0]);
% deplace image by one pixel down
% memorise first line for replication
pos1 = imcrop(in,[1,1,size(in,2)-1,0]);
% cuts last line
pos2 = imcrop(in,[1,1,size(in,2)-1,size(in,1)-2]);
% assemble first line to the rest of the image
pos = [pos1;pos2];
% substracts positive from negative image
out = imlincomb(.5,pos,.5,neg);