c++ - opencv extracting all horizontal and vertical lines separately using morphological operation -


I am new to opencv. I am working with OpenCV and C ++ on Visual Studio 2013. I have a task to remove all the horizontal and vertical lines of a table separately and use it to extract the cells present on the table.

I can only use morphology to achieve this.

Can someone suggest the process of getting it?

Here is a sample document.

sample image

enter image details here Finally found the output. Look at the code.

  string src = "d: //sabari//23.jpg"; Mat IM = reader (source); Mat gray; If (im.channels () == 3) {cvtColor (IM, Gray, CV_BGR2GRAY); } And {gray = IM; } Adaptive threshold (~ Gray, Gray, 255, CV_ADPTI_HHRHHMANNACT, THRESH_BINARY, 15, -2); Mat vertical = gray Clone (); Integer horizontal = gray cols / 30; Mat Structure = Millenestration element (morphascite, shape (horizontal, 1)); Erode (Gray, Gray, Structure, Point (-1, -1)); Diffuse (gray, gray, structure, point (-1, -1)); Imshow ("ans", gray); Write ("D: //out2.jpg", Gray); Int Vertical Size = Vertical Row / 30; Mat vertical structure = obtained stratification element (morphascite, size (1, vertical size)); Erode (vertical, vertical, vertical structure, point (-1, -1)); Diffuse (vertical, vertical, vertical structure, point (-1, -1)); Imshow ("ans1", vertical); Write ("D: //out3.jpg", vertical);  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -