A box-counting estimate for a natural image

Estimate the box counting dimension of this tree:

Comments

  • edited November 2017

    Using the code provided by Mark on stackexchange

    tree = Import[
       "https://marksmath.org/forum/uploads/editor/rd/juxft2wb9gw0.jpg"];
    wholePic = Binarize[tree];
    
    
    data = ImageData[wholePic];
    test[matrix_] := Boole[Length[Cases[matrix, 0, {2}, 1]] > 0];
    count[n_] := Total[Flatten[Map[test, Partition[data, {n, n}], {2}]]];
    radii = Table[2^k, {k, 0, 8}];
    counts = Table[count[r], {r, radii}]
    Fit[Transpose[Log[{1/radii[[2 ;; -3]], counts[[2 ;; -3]]}]], {1, x},x]
    

    Using this method I found that the dimension of this image is 1.767, which is similar to a hexaflake. As you can see I did not compare this result to the box counting method, because I was unsure about the function of "image size _> 2^10".

    I thought it would be worthwhile to analyze different sections of the same picture to see if the dimension would change, so I looked at the left side and the right side separately. Using the same method as above, "which I am still unsure of", I found that the dim(Left)=1.767 and dim(Right)= 1.77 .

    leftPic = Binarize[ImageCrop[tree, {2016, Full}, Right]]; 
    rightPic = Binarize[ImageCrop[tree, {2016, Full}, Left]];
    

    So is the left side of the image more like the whole image, than the right? If anyone knows how to break up an image into smaller squares and run them through this code to find the dimension that would be awesome!

Sign In or Register to comment.