i=imread('plage.jpg');

[D1, k]=normalise(double(i),0);

p=k/10;
d=D1<p;
D=d* 0.1;
for j=2:10
    m=D1<(j*p);
    d=(m-(D>0));
    D=D + double(d*0.1*j);
end
imshow(D); colormap('hot')
    