资源简介
官方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_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论