资源简介
官方MATLAB代码和我手写的测试用例,在MATLAB2018上测试通过。
代码片段和文件信息
%C computes the VAR descriptor.
% J = CONT(IRNLIMSMODE) returns either a rotation invariant local
% variance (VAR) image or a VAR histogram of the image I. The VAR values
% are determined for all pixels having neighborhood defined by the input
% arguments. The VAR operator calculates variance on a circumference of
% R radius circle. The circumference is discretized into N equally spaced
% sample points. Function returns descriptor values in a continuous form or
% in a discrete from if the quantization limits are defined in the argument
% LIMS.
%
% Examples
% --------
%
% im = imread(‘rice.png‘);
% c = cont(im416);
% d = cont(im4161:500:2000);
%
% figure
% subplot(121)imshow(c[]) title(‘VAR image‘)
% subplot(122)imshow(d[]) title(‘Quantized VAR image‘)
function result = cont(varargin)
% Version: 0.1.0
% Check number of input arguments.
error(nargchk(15nargin));
image=varargin{1};
d_image=double(image);
if nargin==1
spoints=[-1 -1; -1 0; -1 1; 0 -1; -0 1; 1 -1; 1 0; 1 1];
neighbors=8;
lims=0;
mode=‘i‘;
end
if (nargin > 2) && (length(varargin{2}) == 1)
radius=varargin{2};
neighbors=varargin{3};
spoints=zeros(neighbors2);
lims=0;
mode=‘i‘;
% Angle step.
a = 2*pi/neighbors;
for i = 1:neighbors
spoints(i1) = -radius*sin((i-1)*a);
spoints(i2) = radius*cos((i-1)*a);
end
if(nargin >= 4 && ~ischar(varargin{4}))
lims=varargin{4};
end
if(nargin >= 4 && ischar(varargin{4}))
mode=varargin{4};
end
if(nargin == 5)
mode=varargin{5};
end
end
if (nargin == 2) && ischar(varargin{2})
mode=varargin{2};
spoints=[-1 -1; -1 0; -1 1; 0 -1; -0 1; 1 -1; 1 0; 1 1];
neighbors=8;
lims=0;
end
% Determine the dimensions of the input image.
[ysize xsize] = size(image);
miny=min(spoints(:1));
maxy=max(spoints(:1));
minx=min(spoints(:2));
maxx=max(spoints(:2));
% Block size each LBP code is computed within a block of size bsizey*bsizex
bsizey=ceil(max(maxy0))-floor(min(miny0))+1;
bsizex=ceil(max(maxx0))-floor(min(minx0))+1;
% Coordinates of origin (00) in the block
origy=1-floor(min(miny0));
origx=1-floor(min(minx0));
% Minimum allowed size for the input image depends
% on the radius of the used LBP operator.
if(xsize < bsizex || ysize < bsizey)
error(‘Too small input image. Should be at least (2*radius+1) x (2*radius+1)‘);
end
% Calculate dx and dy;
dx = xsize - bsizex;
dy = ysize - bsizey;
%Compute the local contrast
for i = 1:neighbors
y = spoints(i1)+origy;
x = spoints(i2)+origx;
% Calculate floors and ceils for the x and y.
fy = floor(y); cy = ceil(y);
fx = floor(x); cx = ceil(x);
% Use double type images
ty = y - fy;
tx = x - fx;
% Calculate the interpolation weigh
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5404 2019-01-07 20:17 getmapping.m
文件 6516 2019-01-07 20:19 lbp.m
文件 255 2019-01-07 20:22 lbptest.m
文件 4378 2019-01-07 20:17 cont.m
- 上一篇:蒙特卡洛模拟法及其Matlab案例
- 下一篇:脉冲计数型鉴频器
相关资源
- 蒙特卡洛模拟法及其Matlab案例
- 导出matlab稀疏矩阵到txt
- matlab块匹配算法
- harris分块提取特征点(matlab)
- 稀疏自动编码器的matlab实现
- MATLAB录音程序:动态波形频谱显示
- 六种常用纹理特征提取方法MATLAB.rar
- MATLAB彩色图片对比度增强直方图均衡
- 基于MATLAB实现画无颜色柱状图
- zw_Matlab工具箱调用SVM算法.zip
- zw_KNN_Matlab.zip
- 带有GUI设计的扩频通信Matlab代码.zip
- 图像骨架提取细化
- 并联机器人动力学matlab求解
- 船舶航线matlab程序编码
- MIMO信号MMSE检测算法MATLAB仿真程序
- matlab简单均线回测1
- 基于MATLAB的LBP图片特征提取算法,人
- 基尼系数matlab编码
- 多属性决策TOPSIS方法matlab程序
- GM(11)预测matlab程序,亲测可行
- Delta并联机构运动学逆解MATLAB程序
- 十多种方法——求解非线性方程组M
- 交通流分配_元胞自动机_matlab实现
- EMD HHT MATLAB源代码,适合初学者
- Matlab实现小波去噪
- SAR 三点目标仿真及RD算法 MATLAB程序
- pLSA的Matlab代码
- 802.11awlan物理层的matlab仿真源码.rar
- LMS算法学习曲线的matlab仿真
评论
共有 条评论