我的matlab中没有entropy函数。 在线等它的源码。有的帮忙发下

 我来答
ruifengcao
2011-06-20 · TA获得超过9490个赞
知道大有可为答主
回答量:3579
采纳率:33%
帮助的人:2059万
展开全部
function E = entropy(varargin)
%ENTROPY Entropy of intensity image.
% E = ENTROPY(I) returns E, a scalar value representing the entropy of an
% intensity image. Entropy is a statistical measure of randomness that can be
% used to characterize the texture of the input image. Entropy is defined as
% -sum(p.*log2(p)) where p contains the histogram counts returned from IMHIST.
%
% ENTROPY uses 2 bins in IMHIST for logical arrays and 256 bins for
% uint8, double or uint16 arrays.
%
% I can be multidimensional image. If I has more than two dimensions,
% it is treated as a multidimensional intensity image and not as an RGB image.
%
% Class Support
% -------------
% I must be logical, uint8, uint16, or double, and must be real, nonempty,
% and nonsparse. E is double.
%
% Notes
% -----
% ENTROPY converts any class other than logical to uint8 for the histogram
% count calculation so that the pixel values are discrete and directly
% correspond to a bin value.
%
% Example
% -------
% I = imread('circuit.tif');
% E = entropy(I)
%
% See also IMHIST, ENTROPYFILT.

% Copyright 1993-2007 The MathWorks, Inc.
% $Revision: 1.1.8.4 $ $Date: 2007/06/04 21:08:49 $

% Reference:
% Gonzalez, R.C., R.E. Woods, S.L. Eddins, "Digital Image Processing
% using MATLAB", Chapter 11.

I = ParseInputs(varargin{:});

if ~islogical(I)
I = im2uint8(I);
end

% calculate histogram counts
p = imhist(I(:));

% remove zero entries in p
p(p==0) = [];

% normalize p so that sum(p) is one.
p = p ./ numel(I);

E = -sum(p.*log2(p));

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function I = ParseInputs(varargin)

iptchecknargin(1,1,nargin,mfilename);

iptcheckinput(varargin{1},{'uint8','uint16', 'double', 'logical'},...
{'real', 'nonempty', 'nonsparse'},mfilename, 'I',1);

I = varargin{1};
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2011-07-05
展开全部
intensity image. Entropy is a statistical measure
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式