**Appendix A**

1. The calculation program of background elimination

I1 = imread ('Original image.tif');

I2 = imread ('Background images.tif');

I1 = rgb2gray (I1); % Image grayscale

I2 = rgb2gray (I2);

Img = imsubtract (I2, I1); Background differentiation

Img = 255/max (max (Img)).\*Img;

Img = imadjust (Img, (0.3, 0.9)); % local image enhancement, *x* value according to the actual situation

threshold = graythresh (Img); % the between-cluster variance method of OSTU threshold figure; subplot (131), imshow (I1); subplot (132), imshow (I2); subplot (133), imshow (Img); 2. Image enhancement calculation procedures I = imread ('Original image.tif'); % read in grayscale I = rgb2gray (I) Subplot (2,1,2),imhist (I),title ('gray histogram'); % for gray histogram 3. Image binarisation calculation procedures I = imread ('\*.bmp'); BW = im2bw (I, 0.43); % Transformation threshold converted gray image into a binary image figure; imshow (BW); title ('Binary Image'); B = size (BW, 1); % returns the number of rows of I if mod (log2(B),1) > 0; % the mod function is a complementary function. Returns the remainder after dividing two numbers. The sign of the result is the same as the divisor error('The size of image must be 2ˆn'); end t = log2(B); % t is 2 to the power of t, which is the number of boxes s = 2ˆ(1:t); % s is the box size Nr = zeros(1,t); % create a 1 line, zero matrix t column for k = 1:t; d = s(k); h = B/d; For m = 1:h %Cycle by line For n = 1:h % Cycle by column A = BW (d\*(m − 1)+(1:d),d\*(n − 1) + (1:d)); mx = max(A(:)); nr = mx; Nr(k) = Nr(k) + nr; end end end r = d./s; x = log(r); y = log(Nr); plot(x,y,'+'); lsline; p = polyfit(x,y,1); Xlabel ('ln (1/epsilon)'); Ylabel ('N (epsilon)'); Dm = p; hold on; z = y./x;
