Ejemplo n.º 1
0
def roi_(origin):
    img = common.binary_(origin, thresh=config.binary_threshold)
    img = common.erode_(img)
    img = common.morph_(img)

    img = common.canny_(img)
    contours = common.findContours_(img, origin)

    # FFT 矫正
    roi = common.minAreaRect_(origin, contours)

    return roi
Ejemplo n.º 2
0
def chosen(origin):
    # randon hough
    img = common.binary_(origin, thresh=config.binary_threshold)
    img = common.erode_(img)
    img = common.morph_(img)

    img = common.canny_(img)
    origin = common.hough_lines_p_(img, origin)

    contours = common.findContours_(img, origin)
    roi = common.boundingRect_(origin, contours)

    return roi