捯饬了一两天才搞好!
在lbp.m下输入下面代码,运行结果如图:
代码:
I=imread('rice.png'); mapping=getmapping(8,'u2'); H1=lbp(I,1,8,mapping,'h'); %LBP histogram in (8,1) neighborhood %using uniform patterns subplot(2,1,1),stem(H1); H2=lbp(I); subplot(2,1,2),stem(H2); SP=[-1 -1; -1 0; -1 1; 0 -1; -0 1; 1 -1; 1 0; 1 1]; I2=lbp(I,SP,0,'i');
结果:
在cout.m下输入以下代码,运行结果如下:
代码:
im = imread('rice.png'); c = cont(im,4,16); d = cont(im,4,16,1:500:2000); figure subplot(121),imshow(c,[]), title('VAR image') subplot(122),imshow(d,[]), title('Quantized VAR image')
结果:
输入
imshow(I2)
可观看