1 | initial version |
If I do an open morph operation with MorphologyEx using a rect kernel that is 12 x 1, I get this image
If I subtract this from the original I get
which is close. Before subtracting, you could find all the contours in the morphed image and filter to only include the table edge by looking at the y of the contour in the image and maybe the aspect ratio of the contour. After filtering, you could then dilate the remaining contours a little before subtracting.