calculate how many regions of white pixels that are surrounded by black pixels?

I have an image that I converted into a 30x30 matrix of 0's and1's. The value 0 represents a white pixel and the value 1 represents a black pixel. A region of white pixels is a circle if it is surrounded by a ring of black pixels that are connected to each other. I am trying to calculate how many circles there are in the matrix. Any idea on how to start this? ( I am not looking for full answer just a idea or guidance on how to start me off).

Thanks very much in advance

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.