简体   繁体   中英

calculation error in histogram features

I am getting the value of kurtosis for only 251 blocks as i divided images into blocks i mnot getting what is wrong actually it should show it for 252 blocks please review the code thanks in advance

clear all;
close all;

x =  imread('image009.png');
rgb = imresize(x,0.5);
green  = rgb(:,:,2);
[m,n]=size(green);
imnum=input('enter image number');
g=1;
q=1;
scaler=36;
scalec=37.5;
bno=1;
g=1;

for i=1:scaler:(m-scaler)
    if((i==1)||(i==(m-scaler))
        continue;    
    end

    for j=1:scalec:(n-scalec)

        if((j==1)||(j==(n-scalec)))
            continue;
        end
        tbpcolr = imcrop(green,[j,i,scalec,scaler])
        ip=input('press some key');
        mgreen = mean2(tbpcolr);
        stats = hisfeatures(tbpcolr);
        Mean(1,g) = stats(1)
        Variance(1,g) =stats(2)
        Skewness(1,g) =stats(3)
        Kurtosis(1,g)=stats(4)
        Energy(1,g) =stats(5)
        Entropy(1,g) =stats(6)
        Kurtosis = Kurtosis(~isnan(Kurtosis))
        Entropy = Entropy(~isnan( Entropy))
        Skewness = Skewness(~isnan(  Skewness))
        g=g+1;
        bno=bno+1; 
    end
end

blockno = [];
for  i = 1:252
    blockno(i)=i;
end

for  i = 1:252
    result_his=vertcat(Energy,Mean,Variance,Kurtosis,Skewness,Entropy,blockno); 
end

result_his=result_his.'

Removing cells with NaN would destroy the matrix structure. Removing whole rows that contain NaN would discard real data. Instead, the Statistics Toolbox has a variety of functions that are similar to other MATLAB functions, but that treat NaN values as missing and therefore ignore them in the calculations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM