hjer
hjer

Reputation: 1

Segmentation of resume images

enter image description here

I'm trying to segment fields from different templates of CV/resume images where I get each segment by itself like for example the education part by itself, the work experience part by itself, and the name... I'm using Otsu thresholding, but it isn't giving a good result.

import cv2
from matplotlib import pyplot as plt

# Load the image
img = cv2.imread('/kaggle/input/extraction/enhanced_image_5059549943886196975.png')
gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

# Smoothing the image to reduce noise
smoothed_image = cv2.GaussianBlur(gray_image, (5, 5), 0)

# Performing OTSU threshold
ret, thresh1 = cv2.threshold(smoothed_image, 0, 255, cv2.THRESH_OTSU | cv2.THRESH_BINARY_INV)

# Specify structure shape and kernel size for line-wise dilation
line_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (25, 60))

# Applying dilation on the threshold image line by line
dilation = cv2.dilate(thresh1, line_kernel, iterations=1)

Upvotes: 0

Views: 73

Answers (0)

Related Questions