def getAffineT(self): num = self.gtShapes.shape[0] self.ms2real = [] self.real2ms = [] for i in range(num): ### Project to meanshape coordinary bndBox = self.bndBoxs[i] initShape = self.initShapes[i] mShape = Shape.shapeNorm2Real(self.meanShape, bndBox) T = Affine.fitGeoTrans(initShape, mShape) self.real2mss.append(T) T = Affine.fitGeoTrans(mShape, initShape) self.ms2reals.append(T)
def detect(self, img, bndbox, initShape): mShape = Shape.shapeNorm2Real(self.meanShape, bndbox) for reg in self.regressors: affineT = Affine.fitGeoTrans(mShape, initShape) reg.detect(img, bndbox, initShape, affineT)