Code covered by the BSD License  

Highlights from
Morphological Shared-Weight Neural Network for Face Recognition

image thumbnail

Morphological Shared-Weight Neural Network for Face Recognition

by

 

31 Dec 2004 (Updated )

MSNN has the ability to learn feature extraction and perform classification at the same time.

imline(I, p1x, p1y, p2x, p2y)
function M = imline(I, p1x, p1y, p2x, p2y)
% This function draws lines on a grayscale image I
% where p1x(i), p1y(i): first point (x,y) and
% p2x(i), p2y(i): second point (x,y)
% and returns M, the image matrix with lines drawn.

len = length(p1x);
for i=1:len
   if p1x(i) > p2x(i)
      px1 = round(p2x(i)); py1 = round(p2y(i));
      px2 = round(p1x(i)); py2 = round(p1y(i));
   else
      px1 = round(p1x(i)); py1 = round(p1y(i));
      px2 = round(p2x(i)); py2 = round(p2y(i));
   end
   if p1y(i) > p2y(i)
      ty1 = round(p2y(i)); tx1 = round(p2x(i));
      ty2 = round(p1y(i)); tx2 = round(p1x(i));
   else
      ty1 = round(p1y(i)); tx1 = round(p1x(i));
      ty2 = round(p2y(i)); tx2 = round(p2x(i));
   end
   h = py2 - py1;
   w = px2 - px1;
   if w ~= 0
      for p=px1:px2
         y = round((h*(p-px1)/w)+py1);
         I(y,p) = 0;
      end
   end
   h = ty2 - ty1;
   w = tx2 - tx1;
   if h ~= 0
      for t=ty1:ty2
         x = round((w*(t-ty1)/h)+tx1);
         I(t,x) = 0;
      end
   end
end
M = I;

Contact us