Consider a black and white image like this
What I am trying to do is to find the region where
Maybe a naive approach:
You define a square of n*n which is the maximum size of the region in which you measure the density. For each point in the image you consider the point as the center of the square and count around the number of black (b) and white (w) points. Using the difference b-w you can determine in which square(s) is the most white.
The most dense regions must be determined in a fuzzy way. If one region has 600 white points and another 599 then, for the human eye, they are the same density. 600 is 100% dense while 599 is 99% dense and 1% non-dense. Use an epsilon for this.
n can be predefined or based on some function (ie. percent of image size).
You could also use a circle/ellipse instead of square/rectangle. Choose what fits your needs best