the core operation is one of the most basic operations in image processing: Running mean.
The running mean is computed by first specifying the kernel function (in your case a square window with odd sized side length) that is applied at every position of an image. The underlying mathematical operation is a convolution integral that means a linear filter operation.
With ImageJ you go to “Process >> Filters >> Convolve…”, define the kernel function with all (e.g. 9x9) values having value 1, check Normalize Kernel and click OK. Please note that this approach requires kernels with odd-sized side length!
Before the filtering you need to invert your image, because you are interested in the black areas of your binary image.
The remaining operations are simple normalizations of the resulting image in order to get values from 0 to 100.