clear
img=imread("SARShip-1.0-30.tif");
[m,n]=size(img);
img=im2uint8(img);
[Freq,X]=hist(double(img(:)),100);
binWidth=X(2)-X(1);
sum(Freq)
bar(X,Freq/binWidth/sum(Freq));
% axis([0,65536,0,4*1e5]
img=double(img);
u=mean(log(img),'all');
sigma2=mean(log(img).^2,'all')-(mean(log(img),'all'))^2;
x=1:256;
f=1./(x.*sqrt(sigma2*2*pi)).*exp(-(log(x)-u).^2/(2*sigma2));
hold on;
plot(x,f);
sum(f)