matlabで画像を処理するときに問題があり、白い画像があり、画像のグレーレベルを印刷して1ずつインクリメントしようとすると、255になり、256にはなりません。コードは次のとおりです。 。カウントは0です。
  function [ count ] = white( I )
    [row,col]=size(I);
    count=0;
    for x=1:row
        for y=1:col
            g=I(x,y);   %the value of the gray level on each pixel
            if((g+1) == 256)
            count=count+1;
            256
        end
    end
  end