Below is what I came up with, which is an average distance between objects for an entire image. An example of the distances being calculated is the image in red, between the given lines in white. If this isn't what you had in mind, then you'll need to explain a bit more the measurement you want to make.
You may want to clean up the lines a bit, as small, isolated pixels can have a dramatic effect on the measurement.
imgin = imread('axhgqs.jpg');
imgin_bw = im2bw(imgin);
dist_map = bwdist(imgin_bw);
lines = watershed(dist_map);
lines = ~(lines > 0);
avg_distance_map = dist_map ;
avg_distance_map(~lines) = 0;
avg_distance_intensity = sum(sum(avg_distance_map)) ;
avg_distance_area = sum(sum(logical(avg_distance_map))) ;
average_distance = avg_distance_intensity / avg_distance_area ;