Split bounding rectangle on white spaces columnwise

asked 2020-06-22 07:14:58 -0600

Malathi_72 gravatar image

updated 2020-06-23 11:48:50 -0600

supra56 gravatar image

image description

snippet:

  outputImage = img.copy()

    npaContours, npaHierarchy = cv2.findContours(rectdilation.copy(),        
                                                 cv2.RETR_EXTERNAL,                 
                                                 cv2.CHAIN_APPROX_SIMPLE)          

    for npaContour in npaContours:                         
        x,y,w,h = cv2.boundingRect(npaContour)
        if w < 10 or h < 10:
            continue  

        cv2.rectangle(outputImage,(x,y),(x+w,y+h),(0,255,0),2)

        if cv2.contourArea(npaContour) > MIN_CONTOUR_AREA:          

            [intX, intY, intW, intH] = cv2.boundingRect(npaContour)

*split npaContour white spaces columnwise

edit retag flag offensive close merge delete

Comments

1

can you take another look at your question , and try to explain, what you have, the purpose of it, and where the problem is ?

right now, it's more "garbage"

berak gravatar imageberak ( 2020-06-22 07:18:31 -0600 )edit

In the highest level boundingRect of contours, want to split the rectangle vertically further. Using in the context of separating characters in word boundingRect.

Malathi_72 gravatar imageMalathi_72 ( 2020-06-22 07:28:31 -0600 )edit
1

an image would be helpful for us understanding your problem

sturkmen gravatar imagesturkmen ( 2020-06-22 10:28:15 -0600 )edit

Added sample image

Malathi_72 gravatar imageMalathi_72 ( 2020-06-22 22:16:21 -0600 )edit

Add two images - one with the situation you have right now (Current condition).
And one with the situation you want to have (Desired condition). As it is right now, its very hard to understand(at least for me)

holger gravatar imageholger ( 2020-06-23 06:30:55 -0600 )edit

Please look into the updated question

Malathi_72 gravatar imageMalathi_72 ( 2020-06-23 09:21:53 -0600 )edit

Oh so you want handwritten word segmentation?

holger gravatar imageholger ( 2020-06-23 09:22:58 -0600 )edit
1
supra56 gravatar imagesupra56 ( 2020-06-23 11:44:53 -0600 )edit

@holger. He wanted white-spaces between vertical lines.

supra56 gravatar imagesupra56 ( 2020-06-23 11:46:47 -0600 )edit
1

this was his description - but looking on the pictures i would say these are handwritten words with some space between them - anyways - anything which gets the job done is useful :-)

holger gravatar imageholger ( 2020-06-23 15:00:43 -0600 )edit