Resume image segmentation

36 Views Asked by At

I'm trying to segment different templates of resumes (split resumes, normal resumes) using Python. The issue here is that sometimes the segmentation method is not splitting certain fields correctly, for example in this resume skills and strengths are divided into too many parts it's not taking them as 1 field (I tried changing the threshold so it groups everything but the problem is since resumes are very different in formats when I tried on another resume I got fields grouped such as experience and education ) Segmented image Original image

import cv2
from matplotlib import pyplot as plt
img = cv2.imread('/kaggle/input/extraction/enhanced_image_-5004958113499463991.png')
gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
smoothed_image = cv2.GaussianBlur(gray_image, (5, 5), 0)
ret, thresh1 = cv2.threshold(smoothed_image, 0, 255, cv2.THRESH_OTSU | cv2.THRESH_BINARY_INV)
rect_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (40, 20))
dilation = cv2.dilate(thresh1, rect_kernel, iterations = 1)
contours, hierarchy = cv2.findContours(dilation, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
0

There are 0 best solutions below