im making a python program to take an image and determine the fractal dimension with different grid sizes for the box counting. i had previously had it working and it got deleted and i cant remember exactly how i had it but i have something similar to it now. the main problem i have now is when the function count runs, N=1 for every size box.
this is my current code
def count(image, size):
N=0
step=size
for i in range(0, Lx, step):
for j in range(0, Ly, step):
if (img_matrix[i:step,j:step] == 0).any():
N += 1
return N
size=np.arange(0,10, 1)
N=0
Ns=[]
for s in size:
N=count(img,s)
Ns.append(N)`
it only gives 1 as the value of Ns. how do i fix this?