Counting the number of sides and number of neighbours of polygonal terrain


I am currently trying to find a way to count the number of sides each individual polygon has, as well as the number of neighbouring polygons each polygon has, the image below are good examples of the kind of images I am trying to work with.

I have attempted using ImageJ to auto-adjust the brightness/contrast of the image, and then using the option of “Image > Adjust > Threshold” to count get the lines of the craters to be the only visible parts of the image on a white background, however I am finding that i am unable to get the images to appear this way, as the method i am attempting to use is giving me the results below:

ESP_025277_2275_RED 1.tif (428.0 KB)

ESP_025277_2275_RED 1 attempt.tif (426.5 KB)

I was hoping to ask if anyone could give me any advice on how to go about this better and if at all possible, off me some guidance on how I would go about my aforementioned counting operations afterwards, as I am fairly new to ImageJ, and am rather lost.

Thank you very much in advanced!


A similar theme was discussed here:

Did you use the themes search engine? (the small circle in top and on the right,a magnifying glass)

This forum is rich in data.
You can also enrich it with your finds!

Hi Mathew,

Thanks for your reply, I had a look at the post you linked, however in that post, the OP already had a binarised image, which is the part I am struggling to get to at the moment, so it wasn’t of much use to me. The side counting does appear that it will be of help when I reach that point, so thank you very much for that!

I am unfortunately struggling to find advice on this website for making the images I am working with binary, I believe I may be missing something obvious, or perhaps am simply not aware of a better way of doing this, as thresholding the image does not seem to be working as I thought it would. But if you are at all able to offer me any advice on how I might go about this, it would be greatly appreciated.

apologies if I have missed any further posts, I had a look using the search tool, but was unable to find anything that seemed to help.

Thanks again,


1 Like

I took your image and do a quick analysis with Ridge Detection.
Here is the result.It may be a way to explore.