Matlab 沿直方图值的范围移动
假设我有一些Matlab 沿直方图值的范围移动,matlab,histogram,shift,Matlab,Histogram,Shift,假设我有一些图像,我找到了它的直方图。也就是说,我有一些方程,我想为直方图中的每个元素计算。如何在MATLAB中沿直方图值移动 我已经做了以下工作: I=imread('xyz.jpg'); h=imhist(I); h(1) % get the value of the first element 这样,为了应用我的方程,我使用了h(1)value作为例子 这边是吗 谢谢。如果您想迭代直方图值,我建议您提取imhist的两个输出(我冒昧地给了它们更具表现力的变量名): 数组bin和count
图像
,我找到了它的直方图
。也就是说,我有一些方程
,我想为直方图中的每个元素计算。如何在MATLAB
中沿直方图值移动
我已经做了以下工作:
I=imread('xyz.jpg');
h=imhist(I);
h(1) % get the value of the first element
这样,为了应用我的方程,我使用了h(1)
value作为例子
这边是吗
谢谢。如果您想迭代直方图值,我建议您提取
imhist
的两个输出(我冒昧地给了它们更具表现力的变量名):
数组bin
和counts
分别包含柱状图bin位置及其计数。然后可以使用for循环:
res = zeros(numel(counts), 1); %// Preallocate array for the result
for k = 1:numel(counts)
%// Apply equation on counts(k) and bins(k), for example:
res(k) = some_equation(bins(k), counts(k));
end
或者,如果可能的话,以矢量形式应用方程式
res = zeros(numel(counts), 1); %// Preallocate array for the result
for k = 1:numel(counts)
%// Apply equation on counts(k) and bins(k), for example:
res(k) = some_equation(bins(k), counts(k));
end