how to resolve this error "subscript indices must either be real positive integers or logicals"

8 ビュー (過去 30 日間)
hi,
Following is the code of Contrast limited histogram Equalization (CLAHE),
[m,n]=size(yy);
NrX=8;NrY=8;
XSize=floor(m/NrX);
YSize=floor(n/NrY);
NrBins=256;
Min=min(yy(:));
Max=max(yy(:));
LUT=makeLUT(Min,Max,NrBins);
% avgBin = NrPixels/NrBins;
Bin=1+LUT(round(yy));
where make makeLUT function is this
function [LUT] = makeLUT(Min,Max,NrBins)
% To speed up histogram clipping, the input image [Min,Max] is scaled down to
% [0,uiNrBins-1]. This function calculates the LUT.
Max1 = Max + max(1,Min) - Min;
Min1 = max(1,Min);
BinSize = fix(1 + (Max - Min)/NrBins);
LUT = zeros(fix(Max - Min),1);
for i=Min1:Max1
LUT(i) = fix((i - Min1)/BinSize);
end
I am getting error here at the following line yy is my image.
Bin=1+LUT(round(yy));
any Suggesion Please !!!
  1 件のコメント
dpb
dpb 2014 年 3 月 31 日
I'm guessing you're getting
round(yy)==0
Maybe you want ceil instead????

サインインしてコメントする。

採用された回答

Muhammad Ali Qadar
Muhammad Ali Qadar 2014 年 4 月 1 日
I did this and it works
Bin=1+LUT(round(yy+1));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Filtering and Enhancement についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by