Split bounding rectangle on white spaces columnwise
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
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"
In the highest level boundingRect of contours, want to split the rectangle vertically further. Using in the context of separating characters in word boundingRect.
an image would be helpful for us understanding your problem
Added sample image
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)
Please look into the updated question
Oh so you want handwritten word segmentation?
@Malathi_72. Does this help rectangle between whitespaces?
@holger. He wanted white-spaces between vertical lines.
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 is right. supra56 is referring to segmenting english characters.Solution goes at sub contours. But this is of indic script. I wanted only the top level contours to be split further vertically.
No. you can't. Looking at second and third vertical line is not white space because of slopes angle. You merely got 2 white spaces.
Unless you shown w/out rectangle image.
The figures shown are of sample input. Atleast on images where 3-4 whitespace columns are their between characters, can i get some assistance.