Skip to content
This repository has been archived by the owner on Jan 12, 2020. It is now read-only.

Commit

Permalink
Show rotation around center and around head
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Apr 18, 2017
1 parent 4dae8eb commit 34e2144
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 6 additions & 3 deletions blog/_posts/2017-04-18-offset-arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,13 @@ give them all the same indices, and `colorview(RGB, r, g, b)` inserts
the grayscale images `r`, `g`, and `b` into the red, green, and blue
channels respectively. If we visualize `cv`, we see the following:

![cameraman_overlay](/blog/_posts/offsetarrays_figures/cameraman_overlay.png)
| around image center | around head (cv) |
|:-------------------:|:----------------:|
| ![cameraman](/blog/_posts/offsetarrays_figures/cameraman_overlay_center.png) | ![cameraman_rot](/blog/_posts/offsetarrays_figures/cameraman_overlay.png) |

which indeed confirms that the rotation is around the head. Alternatively,
we can focus on the overlapping portions of these images like this:
The right image (corresponding to the steps taken above) indeed
confirms that the rotation is around the head. Alternatively, we can
focus on the overlapping portions of these images like this:

```julia
julia> inds = map(intersect, indices(img), indices(img_rotated))
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions blog/_posts/offsetarrays_figures/figures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ save("cameraman.png", img)
save("cameraman_rotated.png", clamp01nan.(img_rotated))
cv = colorview(RGB, paddedviews(0, img, img_rotated, img)...)
save("cameraman_overlay.png", clamp01nan.(cv))
pimg = parent(img)
tfmcntr = recenter(RotMatrix(-pi/6), center(pimg))
img_rotated_cntr = warp(pimg, tfmcntr)
cvc = colorview(RGB, paddedviews(0, pimg, img_rotated_cntr, pimg)...)
save("cameraman_overlay_center.png", clamp01nan.(cvc))
inds = map(intersect, indices(img), indices(img_rotated))
cvi = colorview(RGB, img[inds...], img_rotated[inds...], img[inds...])
save("cameraman_overlay_interior.png", clamp01nan.(cvi))
Expand Down

0 comments on commit 34e2144

Please sign in to comment.