vb.net - Grid letters with rectangle OCR -
i have been trying grid each letter rectangle on image (on image there colors white , black). i've started this:
dim bmp bitmap = label1.image dim xmax integer dim ymax integer xmax = label1.width - 1 ymax = label1.height - 1 dim top, bottom, left, right integer dim first boolean = true dim last boolean = false dim first2 boolean = true dim last2 boolean = false dim pen pen = pens.red x = 0 xmax y = 0 ymax bmp.getpixel(x, y) if .r = 0 , .g = 0 , .b = 0 , first = true left = x first = false last = true elseif .r = 0 , .g = 0 , .b = 0 , last = true right = x end if end next y next x y = 0 ymax x = 0 xmax bmp.getpixel(x, y) if .r = 0 , .g = 0 , .b = 0 , first2 = true top = y first2 = false last2 = true elseif .r = 0 , .g = 0 , .b = 0 , last2 = true bottom = y end if end next x next y first = true first2 = true last = false last2 = false dim rect new rectangle(left, top, right - left, bottom - top) dim g graphics = graphics.fromimage(bmp) g.drawrectangle(pen, rect) label1.image = bmp
it'll check of pixels on image , it'll black ones, draw rectangle around 1 letter couldn't more 1 @ time. still can't use seperate letters.
i'll thankful of responses.
Comments
Post a Comment