c = imread('FractalTree.jpg');

figure(1)
imagesc(c)
colormap gray
axis image

figure(2)
boxcount(c);

figure(3)
[n,r] = boxcount(c,'slope');

df = -diff(log(n))./diff(log(r));
disp(['Fractal dimension, Df = ' num2str(mean(df(4:8))) ' +/- ' num2str(std(df(4:8)))]);

figure(4)
c = randcantor(0.8, 2048, 2);
imagesc(~c)
colormap gray
axis image
