lbp_new.m
上传用户:kandtrade
上传日期:2009-06-26
资源大小:12k
文件大小:5k
源码类别:

图形图象

开发平台:

Matlab

  1. %LBP returns the local binary pattern image or LBP histogram of an image.
  2. %  J = LBP(I,R,N,MAPPING,MODE) returns either a local binary pattern
  3. %  coded image or the local binary pattern histogram of an intensity
  4. %  image I. The LBP codes are computed using N sampling points on a 
  5. %  circle of radius R and using mapping table defined by MAPPING. 
  6. %  See the getmapping function for different mappings and use 0 for
  7. %  no mapping. Possible values for MODE are
  8. %       'h' or 'hist'  to get a histogram of LBP codes
  9. %       'nh'           to get a normalized histogram
  10. %  Otherwise an LBP code image is returned.
  11. %
  12. %  J = LBP(I) returns the original (basic) LBP histogram of image I
  13. %
  14. %  J = LBP(I,SP,MAPPING,MODE) computes the LBP codes using n sampling
  15. %  points defined in (n * 2) matrix SP. The sampling points should be
  16. %  defined around the origin (coordinates (0,0)).
  17. %
  18. %  Examples
  19. %  --------
  20. %       I=imread('rice.png');
  21. %       mapping=getmapping(8,'u2'); 
  22. %       H1=LBP(I,1,8,mapping,'h'); %LBP histogram in (8,1) neighborhood
  23. %                                  %using uniform patterns
  24. %       subplot(2,1,1),stem(H1);
  25. %
  26. %       H2=LBP(I);
  27. %       subplot(2,1,2),stem(H2);
  28. %
  29. %       SP=[-1 -1; -1 0; -1 1; 0 -1; -0 1; 1 -1; 1 0; 1 1];
  30. %       I2=LBP(I,SP,0,'i'); %LBP code image using sampling points in SP
  31. %                           %and no mapping. Now H2 is equal to histogram
  32. %                           %of I2.
  33. function result = lbp(varargin) % image,radius,neighbors,mapping,mode)
  34. % Version 0.3
  35. % Authors: Marko Heikkil