コード例 #1
0
def segment(image, addr, extras):
    log = cap.logger(extras, image)
    clone = cv.CloneImage(image)
    components = cap.findCCs(image, 0, lambda col: col <= 128, lambda comp: comp[0] < 10)
    log.log(cap.drawComponents(clone, components), False)
    components = cap.joinCCs(components, cap.rectsIntersectH)
    log.log(cap.drawComponents(clone, components), False)
    assert(len(components) <= nSegs)
    parts = cap.partsFromnSegs5(components)
    components = cap.spltCCs(components, parts, projRadius=4, thresh=1)
    log.log(cap.drawComponents(clone, components), False)
    segments = map(lambda comp: comp[3], components)
    log.log(cap.joinImagesH(segments), False)
    cap.processExtras(log.steps, addr, extras, cap.CAP_STAGE_SEGMENT)
    return segments
コード例 #2
0
ファイル: recognise.py プロジェクト: woto/EPC
def recognise(segments, addr, extras):
    allParts = cap.partsFromnSegs5(segments)
    result = splitRecogniseAll(segments, allParts, shiftRadius=4)
    cap.processExtras([cap.joinImagesH(segments)], addr, extras, cap.CAP_STAGE_RECOGNISE)
    return result
コード例 #3
0
def recognise(segments, addr, extras):
    allParts = cap.partsFromnSegs5(segments)
    result = splitRecogniseAll(segments, allParts, shiftRadius=4)
    cap.processExtras([cap.joinImagesH(segments)], addr, extras,
                      cap.CAP_STAGE_RECOGNISE)
    return result