1 | initial version |
Hi. You can use the findContours function to detect all contours in your image. It returns also a hierarchy of the contours which provides you information about the image topology. If you then sum up the area of the contours in the second hierarchy level you have the result.
Here is an example of how to use it.