|
1 | 1 | using CoordinateTransformations, Rotations, TestImages, ImageCore, StaticArrays, OffsetArrays, Interpolations, LinearAlgebra
|
2 | 2 | using EndpointRanges
|
| 3 | +using Tau |
3 | 4 | using Test, ReferenceTests
|
4 | 5 |
|
5 | 6 | include("twoints.jl")
|
@@ -465,5 +466,23 @@ NaN NaN NaN NaN NaN NaN NaN
|
465 | 466 | @test !any(isnan, imrotate(img, π/3, axes(img); fillvalue=0.0))
|
466 | 467 | @test !any(isnan, imrotate(img, π/3, axes(img), fillvalue=0.0))
|
467 | 468 | end
|
| 469 | + |
| 470 | + @testset "Examples from #79" begin |
| 471 | + @test axes(imrotate(img_camera, pi/2)) == axes(img_camera) |
| 472 | + @test imrotate(imrotate(imrotate(imrotate(img_camera, pi/2), pi/2), pi/2), pi/2) ≈ img_camera |
| 473 | + @test imrotate(imrotate(img_camera, pi), pi) == img_camera |
| 474 | + # Also check a "generic" irrational (one that happens to be quite special) |
| 475 | + ## First, check that this hits the generic code path (if we change that, pick a different irrational) |
| 476 | + @test ImageTransformations._mod2pi(τ) isa Float64 |
| 477 | + ## Now check that it gives the expected result |
| 478 | + @test imrotate(img_camera, τ) ≈ img_camera |
| 479 | + |
| 480 | + # check special rotation degrees |
| 481 | + img = rand(Gray{N0f8}, 100, 50) |
| 482 | + @test size(imrotate(img, pi/2)) == (50, 100) |
| 483 | + @test size(imrotate(img, pi)) == (100, 50) |
| 484 | + @test size(imrotate(img, 3pi/2)) == (50, 100) |
| 485 | + @test size(imrotate(img, 2pi)) == (100, 50) |
| 486 | + end |
468 | 487 | end
|
469 | 488 | end
|
0 commit comments