This is an important question with many possible answers.
The paper suggested by @AHMED Munir is excellent. On the plus side in that paper, the focus is on volumetric representation of regions of a 2D image instead of the whole image. That is basically a very sensible divide-and-conquer approach.
However, the mathematics underlying the suggested approach is not given. Instead, with point-cloud reconstruction with hole filling, an ad hoc approach is presented. The one outstanding part of this paper is the interpolating of samples using Edelsbrunner alpha shapes. This is promising! However, this leaves us guessing about the structures (and mappings) underlying the proposed approach.
In my opinion, It is necessary to take into account that there are ``holes' of different types: it not the same a `hole' represented by a 2-sphere that the a `hole' represented by a torus.
You can use at lest two different techniques:
-Compute the (simplicial) singular homology groups
You find ``holes'' represented by compact pseudo-manifods (for instance the pseudo-manifod obtained from a 2-sphere by identifying two different points).
-Compute bordisrm homology groups (generalized homology theory)
You find ``holes' represented by compact manifolds
Note1: There are many algorithms to compute homology groups
Note2: Persistent homology studies how `holes' appear and disappear in a uni-parametric family of spaces.