Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotation operation is inaccurate #154

Closed
myuanz opened this issue Jan 19, 2022 · 2 comments · Fixed by #155
Closed

Rotation operation is inaccurate #154

myuanz opened this issue Jan 19, 2022 · 2 comments · Fixed by #155

Comments

@myuanz
Copy link

myuanz commented Jan 19, 2022

b_img = ones(N0f8, (100, 100))
b_img = colorview(Gray, b_img)


mosaicview(
    b_img, 
    imrotate(b_img, π), 
    imrotate(b_img, π, axes(b_img)),
    
    imrotate(b_img, 179 / 180 * π), 
    imrotate(b_img, 180 / 180 * π), 
    imrotate(b_img, 181 / 180 * π), 

    nrow=2, ncol=3, npad=20, fillvalue=colorant"white"
)

test (1)

Regardless of image size, black bars are at least two pixels in size.

Julia Version 1.7.1
Commit ac5cc99908* (2021-12-22 19:35 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      "Manjaro Linux"
  uname: Linux 5.10.84-1-MANJARO JuliaImages/Images.jl#1 SMP PREEMPT Wed Dec 8 09:50:30 UTC 2021 x86_64 unknown
  CPU: Intel(R) Xeon(R) Gold 6226R CPU @ 2.90GHz: 
                 speed         user         nice          sys         idle          irq
       JuliaImages/Images.jl#1-64  1200 MHz   64345068 s      16198 s   16151708 s  1720339615 s     739238 s
       
  Memory: 991.7728500366211 GB (93890.00390625 MB free)
  Uptime: 2.83035374e6 sec
  Load Avg:  2.23  2.05  2.72
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.0 (ORCJIT, cascadelake)
Environment:
  HOME = /home/myuan
  TERM = xterm-256color
  PATH = /usr/local/sbin:/usr/local/bin:/usr/bin:/var/lib/snapd/snap/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
(@v1.7) pkg> st
      Status `~/.julia/environments/v1.7/Project.toml`
  [c7e460c6] ArgParse v1.1.4
  [6e4b80f9] BenchmarkTools v1.2.2
  [336ed68f] CSV v0.9.11
  [82f2e89e] ClickHouse v0.2.1
  [150eb455] CoordinateTransformations v0.6.2
  [5789e2e9] FileIO v1.11.2
  [7073ff75] IJulia v1.23.2
  [82e4d734] ImageIO v0.5.9
  [6218d12a] ImageMagick v1.2.2
  [02fcd773] ImageTransformations v0.8.13
  [916415d5] Images v0.24.1
  [4138dd39] JLD v0.12.5
  [23992714] MAT v0.10.2
  [7eb4fadd] Match v1.2.0
  [b98c9c47] Pipe v1.3.0
  [91a5bcdd] Plots v1.25.3
  [438e738f] PyCall v1.92.5
  [6038ab10] Rotations v1.1.1
  [90137ffa] StaticArrays v1.3.2
  [731e570b] TiffImages v0.5.2
  [ddb6d928] YAML v0.4.7
@johnnychen94 johnnychen94 transferred this issue from JuliaImages/Images.jl Jan 19, 2022
@johnnychen94
Copy link
Member

Nice catch. I noticed that you're using an old ImageTransformations version, here's what v0.9.3 produces:

out

For imrotate(img, pi) and imrotate(img, pi, axes(img)) it's working as expected. While for imrotate(img, 1.0 * pi) it is not:

img = rand(4, 4)
imrotate(img, pi) == imrotate(img, 1.0 * pi) # false

@johnnychen94
Copy link
Member

Fixed by #155. In v0.9.4:

out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants