def silhoutteCurve(A_8U): h, w = A_8U.shape contour = findContours(A_8U, 200.0) contour.resample(span=5) silhoutteCurve = NormalCurve() silhoutteCurve.setContour(contour) silhoutte_contour = findContours(A_8U, 127.0) S_8U = contourMask(silhoutte_contour, h, w) S_8U[A_8U < 127] = 255 return silhoutteCurve, S_8U
def isophoteCurve(I_8U, iso_value, M_8U): contour = findContours(I_8U, 255 * iso_value) print contour.segments() contour.clipByMask(M_8U) contour.resample(span=5) contour = smoothing_contour(contour) isophoteCurve = IsophoteCurve() isophoteCurve.setContour(contour) isophoteCurve.setIsoValue(iso_value) isophoteCurve.setSilhouetteMask(M_8U) return isophoteCurve