I am new to image processing using opencv(C++) and I'm trying to develop a naive application to teach myself the basics related to it such as the morphology operations, edge detection, contours, etc. The application aims to extract articles from the image of a newspaper by building rectangular boxes around each article.
I first binarise the given image followed by which I apply dilation to create connected components. I then wish to group these connected components together into paragraphs and headings and then move onto clubbing the individual entities of an article into one. But the problem is that I am unable to decide what the size of the Kernel should be which I use to apply dilation to form these connected components, is there a way to dynamically determine the kernel size in some way?