Esempio n. 1
0
def deRotate(seg):
    box_vtx = cap.minAreaRectImage(seg)
    pts = sorted(box_vtx, key=lambda vtx: vtx[1], reverse=True)[:2]
    slope = findLineSlope(*pts)
    if slope < 20.0:
        seg = doRotate(seg, -slope, fillval=0, resize=True)
        seg = cap.getSubImage(seg, cap.findNonBlackRect(seg, thresh=1))
    return seg
Esempio n. 2
0
def deRotate(seg):
    box_vtx = cap.minAreaRectImage(seg)
    pts = sorted(box_vtx, key=lambda vtx: vtx[1], reverse=True)[:2]
    slope = findLineSlope(*pts)
    if slope < 20.0:
        seg = doRotate(seg, -slope, fillval=0, resize=True)
        seg = cap.getSubImage(seg, cap.findNonBlackRect(seg, thresh=1))
    return seg
Esempio n. 3
0
 def areafilter(comp):
     w, h = cap.minAreaRectImage(comp[3], returnPoints=False)[1]
     return w * h >= minRectArea
Esempio n. 4
0
File: segment.py Progetto: woto/EPC
 def areafilter(comp):
     w, h = cap.minAreaRectImage(comp[3], returnPoints=False)[1]
     return w * h >= minRectArea