Algo Name: Detecting Elongated Shape in 2D Image by Convolution with Directed Lines
What you are essentially doing is a matched filter. However, thanks to Hough transform, your filter (line) is oriented and therefore I would call it an oriented matched filter. For generating the Bresenham line and sampling the pixels you might want the use the OpenCV line iterator. The simple usage would be similar to:

cv::LineIterator it(image, pt1, pt2, 8);
std::vector&lt;cv::Vec3b&gt; buf(it.count);
std::vector&lt;cv::Point&gt; points(it.count);

for(int i = 0; i &lt; it.count; i++, ++it)
{
    buf[i] = *(const cv::Vec3b)*it;
    points[i] = it.pos();
}


The hole detection part can also be implemented using convolutions as follows:


Convolve the image with a horizontal convolution kernel composed of the oriented line. Use filter2D.
Threhsold the result to identify the areas with holes (use threshold).
Perform a blob-filtering and select the desired hole.


Even though I think that this approach is really valid and would work fine in many cases, the typical blob-person would approach the problem differently: First identify the large connected components in the image and filter out the rest. Within that single large component, perform a morphological hole filling. This is a pretty standard pipeline, and with that method, you will be able to find more tools (blob analysis) to help you. For example OpenCV methods such as findContours, drawContours or morphologyEx come handy.

Finally, if you know the shape of the hole, you might benefit from e.g. ellipse detection to directly find it.

Hope these help.