资源简介
程序提取了很多直方图所需要的参数特征,如均值、方差、偏度、峰度、能量和熵。
代码片段和文件信息
function stats = chip_histogram_features( varargin )
% ------------
% Description:
% ------------
% This function is to obtain state of the art histogram based features
% such as:
% Mean
% Variance
% Skewness
% Kurtosis
% Energy
% Entropy
% ---------
% History:
% ---------
% Creation: beta Date: 09/11/2007
%----------
% Example:
%----------
% Stats = chip_histogram_features( I‘NumLevels‘9‘G‘[] )
%
% -----------
% Author:
% -----------
% (C)Xunkai Wei
% Beijing Aeronautical Technology Research Center
% Beijing %9203-1210076
%
% Parameter checking
[I NL GL] = ParseInputs(varargin{:});
% Scale I so that it contains integers between 1 and NL.
if GL(2) == GL(1)
SI = ones(size(I));
else
slope = (NL-1) / (GL(2) - GL(1));
intercept = 1 - (slope*(GL(1)));
SI = round(imlincomb(slopeIintercept‘double‘));
end
% Clip values if user had a value that is outside of the range e.g. double
% image = [0 .5 2;0 1 1]; 2 is outside of [01]. The order of the following
% lines matters in the event that NL = 0.
SI(SI > NL) = NL;
SI(SI < 1) = 1;
%--------------------------------------------------------------------------
% 1. Calculate histogram for all scaled gray level from 1 to NL
%--------------------------------------------------------------------------
% Get image size
s = size(SI);
% Generate gray level vector
Gray_vector = 1:NL;
% intialize parameters
Histogram = zeros(1NL);
% Using inline function numel make it easy
for i =1:NL
Histogram(i) = numel(find(SI==i));
end
%--------------------------------------------------------------------------
% 2. Now calculate its histogram statistics
%--------------------------------------------------------------------------
% Calculate obtains the approximate probability density of occurrence of the intensity
% levels
Prob = Histogram./(s(1)*s(2));
% 2.1 Mean
Mean = sum(Prob.*Gray_vector);
% 2.2 Variance
Variance = sum(Prob.*(Gray_vector-Mean).^2);
% 2.3 Skewness
Skewness = calculateSkewness(Gray_vectorProbMeanVariance);
% 2.4 Kurtosis
Kurtosis = calculateKurtosis(Gray_vectorProbMeanVariance);
% 2.5 Energy
Energy = sum(Prob.*Prob);
% 2.6 Entropy
Entropy = -sum(Prob.*log(Prob));
%-------------------------------------------------------------------------
% 3. Insert all features and return
%--------------------------------------------------------------------------
stats =[Mean Variance Skewness Kurtosis Energy Entropy];
% End of funtion
%--------------------------------------------------------------------------
% Utility functions
%--------------------------------------------------------------------------
function Skewness = calculateSkewness(Gray_vectorProbMeanVariance)
% Calculate Skewness
term1 = Prob.*(Gray_vector-Mean).^3;
term2 = sqrt(Variance);
Skewness = term2^(-3)*sum(term1);
function Kurtosis = calculateKurtosis(Gray_vectorProbMe
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5427 2008-09-16 21:24 chip_histogram_features.m
----------- --------- ---------- ----- ----
5427 1
- 上一篇:QT程序学生管理系统
- 下一篇:stm32 isp工具支持rts,cts控制复位
相关资源
- cocos2dx-3.17 坦克大战游戏 lua代码和资
- 原创Qt 串口基础编程代码
- 一个强大的虚拟机的源代码。虽然是
- SVPWM源代码,非常好用
- 标准计算器及科学计算器源代码
- 使用Qt实现可编辑的画图程序
- 使用Qt实现简单的画图程序
- CSharp英文背单词源代码
- 监视界面代码
- 全国城市代码,国际上通用的,相关
- 常用哈希算法代码实现
- 单片机课程设计含源代码
- 数据结构课设拓扑排序源代码教学计
- linux入侵检测源代码简单
- 递推最小二乘法的代码
- 制作动画GIF的VC源代码,八叉树算法生
- 毕业设计论文-会员管理系统含代码
- 社会保险管理信息系统指标集与代码
- 通信原理 LabVIEW 3-8 m序列生成代码
- 酒店管理系统 包括源代码和毕业论文
- 泡泡龙游戏,逻辑源代码
- PV操作的实现源代码+报告
- FIRA足球机器人仿真比赛DLL及源代码
- 远程桌面仅观看服务端和客户端源代
- MOD11A1批量重投影代码
- pic io口模拟iic的mcp7940代码
- 四川大学操作系统虚拟内存管理实验
- 超分辨率重建代码
- apriori算法各种代码
- 劳斯稳定性判据程序代码
评论
共有 条评论