资源简介
程序提取了很多直方图所需要的参数特征,如均值、方差、偏度、峰度、能量和熵。

代码片段和文件信息
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控制复位
相关资源
- 破解source insight4.00.0096
- 蓝牙源代码应用于LINUX
- 简单好用的Nhibernate代码自动生成工具
- KUKA 编程案例讲解.ppt
- bp神经网络源代码,可直接运行
- 随机森林R语言代码
- 计算机图形学 边填充算法实现代码
- 直流无刷电机方波驱动 stm32 例程代码
- 仿知乎界面小程序源代码
- 贪吃蛇源代码.fla
- 周立功开发板ProASIC3实验-syn_FIFO代码
- IMX385驱动代码.zip
- dotnet 写字板 实验 源代码 不好请要不
- 图像二维小波变换的实现源代码
- 八三编码器设计 VHDL代码 简单,包附
- linux应用层的华容道游戏源代码
- 交通咨询模拟系统完整代码
- http请求状态代码
- 数值分析所有实验代码
- 网上拍卖系统完整源代码
- 音乐代码转换软件 单片机编程时用
- CSMA/CD等动画演示加源代码
- silicon lab公司的收音IC SI47XX全套开发工
- 用51单片机实现G代码翻译
- 合同管理系统的源代码(附数据库)
- 用VC 编写的仿QQ聊天室程序源代码
- web班级网站设计代码
- 38k单片机红外发送代码、keil
- STM32F103 串口程序(完整版)
- 网络唤醒代码
评论
共有 条评论