From c81636849529f7d49776602d278fb2327f76c705 Mon Sep 17 00:00:00 2001 From: lorenzoh Date: Wed, 6 Apr 2022 14:58:16 +0200 Subject: [PATCH 1/2] Fix crop-projective composition Fixes a bug where composing a `CroppedProjectiveTransform` with another `ProjectiveTransform` would cause the cropping to be skipped. Now, this instead creates a `Sequence` meaning the crop is properly applied; however, the last projection is not fused with that before the crop. --- src/projective/crop.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/projective/crop.jl b/src/projective/crop.jl index c24ecab..c009ac6 100644 --- a/src/projective/crop.jl +++ b/src/projective/crop.jl @@ -101,6 +101,10 @@ function compose(composed::ComposedProjectiveTransform, cropped::CroppedProjecti end +function compose(cropped::CroppedProjectiveTransform, projective::ProjectiveTransform) + return Sequence(cropped, projective) +end + """ offsetcropbounds(sz, bounds, offsets) From b89c7f8414f5d5f18ec6056974b2086db83ff98f Mon Sep 17 00:00:00 2001 From: lorenzoh Date: Wed, 6 Apr 2022 15:44:10 +0200 Subject: [PATCH 2/2] fix test case --- test/projective/affine.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/projective/affine.jl b/test/projective/affine.jl index 9efc780..a8c0ae0 100644 --- a/test/projective/affine.jl +++ b/test/projective/affine.jl @@ -157,11 +157,12 @@ end @testset ExtendedTestSet "2D" begin tfms = compose( Rotate(10), - FlipX(), FlipY(), + FlipX(), + FlipY(), ScaleRatio((.8, .8)), - RandomCrop((10, 10)), WarpAffine(0.1), - Zoom((1., 1.2)) + Zoom((1., 1.2)), + RandomCrop((10, 10)), ) testprojective(tfms) end