Number of Columns Detector

I am trying to develop an algorithm that will count the number of columns blocks a specific image has.
I tried a few algorithms, will paste them here, but they are not always accurate.

I can see the contours and merge them, but not sure how to get a column itself.

Algorithm 1: mser-contours.py · GitHub
Algorithm 2:

def textBlocks(img):

thresholded = cv2.adaptiveThreshold(
            img, 255,
            cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV,
            25,
            15
        )

kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (20, 13))
closing = cv2.morphologyEx(thresholded, cv2.MORPH_CLOSE, kernel) 

contours,im2 = cv2.findContours(closing, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
new_countours = []
for contour in contours:
    x,y,w,h = cv2.boundingRect(contour)
    if h< 30:
        continue
    new_countours.append(contour)



for contour in new_countours: 
    convex_contour = cv2.convexHull(contour)
    area = cv2.contourArea(convex_contour)
    rect = cv2.minAreaRect(contour)
    x,y,w,h = cv2.boundingRect(contour) 
    cv2.drawContours(img, [convex_contour], -1, (33,33,33), 3)

# show_scaled("contours", img)
return img

`

This is the picture I have