diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/AreaOfInterest/AOI2DScene.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/argaze/AreaOfInterest/AOI2DScene.py b/src/argaze/AreaOfInterest/AOI2DScene.py index 60f17ef..69b1391 100644 --- a/src/argaze/AreaOfInterest/AOI2DScene.py +++ b/src/argaze/AreaOfInterest/AOI2DScene.py @@ -114,10 +114,10 @@ class AOI2DScene(AOIFeatures.AOIScene): def reframe(self, aoi_name: str, size: tuple) -> AOI2DSceneType: """ - Project whole scene into an AOI. + Reframe whole scene to a scene bounded by an AOI. Parameters: - aoi: name of AOI where to project scene + aoi: name of AOI used to reframe scene Returns: reframed AOI 2D scene @@ -125,19 +125,19 @@ class AOI2DScene(AOIFeatures.AOIScene): assert(self[aoi_name].points_number == 4) - # Edit perspective (P) allowing to transform source axis (Src) into destination axis (Dst) + # Edit affine transformation (M) allowing to transform source axis (Src) into destination axis (Dst) Src = self[aoi_name].clockwise().astype(numpy.float32) Src_origin = Src[0] Src = Src - Src_origin Dst = numpy.float32([[0, 0], [size[0], 0], [size[0], size[1]], [0, size[1]]]) - P = cv2.getAffineTransform(Src[:3], Dst[:3])[:, :2] + M = cv2.getAffineTransform(Src[:3], Dst[:3])[:, :2] # Apply perspective matrix to each AOI aoi2D_scene = AOI2DScene() for name, aoi2D in self.items(): - aoi2D_scene[name] = numpy.matmul(aoi2D - Src_origin, P.T) + aoi2D_scene[name] = numpy.matmul(aoi2D - Src_origin, M.T) return aoi2D_scene
\ No newline at end of file |