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 :-)