To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
begin
import Pkg
Pkg.activate(mktempdir())
Pkg.add([
Pkg.PackageSpec(name="Images", version="0.22.4"),
Pkg.PackageSpec(name="ImageMagick", version="0.7"),
Pkg.PackageSpec(name="PlutoUI", version="0.7"),
Pkg.PackageSpec(name="HypertextLiteral", version="0.5")
])

using Images
using PlutoUI
using HypertextLiteral
: @htl, @htl_str

end
❔
  Activating new project at `/tmp/jl_vMoV28`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
   Installed Calculus ──────────── v0.5.2
   Installed Reexport ──────────── v0.2.0
   Installed ImageMagick ───────── v0.7.9
   Installed PlutoUI ───────────── v0.7.1
   Installed Images ────────────── v0.22.4
   Installed DualNumbers ───────── v0.6.9
   Installed ImageQualityIndexes ─ v0.1.4
   Installed MappedArrays ──────── v0.2.2
   Installed Quaternions ───────── v0.4.9
   Installed Rotations ─────────── v1.2.0
   Installed TiledIteration ────── v0.2.5
   Installed HypertextLiteral ──── v0.5.2
    Updating `/tmp/jl_vMoV28/Project.toml`
  [ac1192a8] + HypertextLiteral v0.5.2
  [6218d12a] + ImageMagick v0.7.9
  [916415d5] + Images v0.22.4
  [7f904dfe] + PlutoUI v0.7.1
    Updating `/tmp/jl_vMoV28/Manifest.toml`
  [621f4979] + AbstractFFTs v1.5.0
  [79e6a3ab] + Adapt v4.3.0
  [13072b0f] + AxisAlgorithms v1.0.1
  [39de3d68] + AxisArrays v0.4.7
  [b99e7846] + BinaryProvider v0.5.10
  [49dc2e85] + Calculus v0.5.2
  [aafaddc9] + CatIndices v0.2.2
  [d360d2e6] + ChainRulesCore v1.25.1
  [9e997f8a] + ChangesOfVariables v0.1.10
  [3da002f7] + ColorTypes v0.10.12
  [c3611d14] + ColorVectorSpace v0.8.7
  [5ae59095] + Colors v0.12.11
  [34da2185] + Compat v4.16.0
  [ed09eef8] + ComputationalResources v0.3.2
  [150eb455] + CoordinateTransformations v0.6.3
  [dc8bdbbb] + CustomUnitRanges v1.0.2
  [9a962f9c] + DataAPI v1.16.0
  [864edb3b] + DataStructures v0.18.22
  [b4f34e82] + Distances v0.10.12
  [ffbed154] + DocStringExtensions v0.9.5
  [fa6b7ba4] + DualNumbers v0.6.9
  [4f61f5a4] + FFTViews v0.3.2
  [7a1cc6ca] + FFTW v1.9.0
  [5789e2e9] + FileIO v1.17.0
  [53c48c17] + FixedPointNumbers v0.8.5
  [a2bd30eb] + Graphics v1.1.3
  [ac1192a8] + HypertextLiteral v0.5.2
  [bbac6d45] + IdentityRanges v0.3.1
  [2803e5a7] + ImageAxes v0.6.9
  [f332f351] + ImageContrastAdjustment v0.3.7
  [a09fc81d] + ImageCore v0.8.22
  [51556ac3] + ImageDistances v0.2.13
  [6a3955dd] + ImageFiltering v0.6.21
  [6218d12a] + ImageMagick v0.7.9
  [bc367c6b] + ImageMetadata v0.9.5
  [787d08f9] + ImageMorphology v0.2.11
  [2996bd0c] + ImageQualityIndexes v0.1.4
  [4e3cecfd] + ImageShow v0.2.3
  [02fcd773] + ImageTransformations v0.8.13
  [916415d5] + Images v0.22.4
  [9b13fd28] + IndirectArrays v0.5.1
  [a98d9a8b] + Interpolations v0.13.6
  [8197267c] + IntervalSets v0.7.11
  [3587e190] + InverseFunctions v0.1.17
  [92d709cd] + IrrationalConstants v0.1.1
  [c8e1da08] + IterTools v1.4.0
  [692b3bcd] + JLLWrappers v1.7.0
  [2ab3a3ac] + LogExpFunctions v0.3.28
  [1914dd2f] + MacroTools v0.5.16
  [dbb5928d] + MappedArrays v0.2.2
  [e1d29d7a] + Missings v1.2.0
  [e94cdb99] + MosaicViews v0.3.4
  [77ba4419] + NaNMath v1.0.3
  [6fe1bfb0] + OffsetArrays v1.17.0
  [bac558e1] + OrderedCollections v1.8.1
  [5432bcbf] + PaddedViews v0.5.12
  [d96e819e] + Parameters v0.12.3
  [7f904dfe] + PlutoUI v0.7.1
  [aea7be01] + PrecompileTools v1.2.1
  [21216c6a] + Preferences v1.4.3
  [94ee1d12] + Quaternions v0.4.9
  [b3c3ace0] + RangeArrays v0.3.2
  [c84ed2f1] + Ratios v0.4.5
  [3cdcf5f2] + RecipesBase v1.3.4
  [189a3867] + Reexport v0.2.0
  [ae029012] + Requires v1.3.1
  [6038ab10] + Rotations v1.2.0
  [699a6c99] + SimpleTraits v0.9.4
  [a2af1166] + SortingAlgorithms v1.2.1
  [276daf66] + SpecialFunctions v1.8.8
  [cae243ae] + StackViews v0.1.2
  [90137ffa] + StaticArrays v0.12.6
  [82ae8749] + StatsAPI v1.7.1
  [2913bbd2] + StatsBase v0.33.21
  [fd094767] + Suppressor v0.2.8
  [06e1c1a7] + TiledIteration v0.2.5
  [3a884ed6] + UnPack v1.0.2
  [efce3f68] + WoodburyMatrices v0.5.6
  [f5851436] + FFTW_jll v3.3.11+0
  [1d5cc7b8] + IntelOpenMP_jll v2025.0.4+0
  [856f044c] + MKL_jll v2025.0.1+1
  [efe28fd5] + OpenSpecFun_jll v0.5.6+0
  [1317d2d5] + oneTBB_jll v2022.0.0+0
  [0dad84c5] + ArgTools
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8ba89e20] + Distributed
  [f43a241f] + Downloads
  [7b1f6079] + FileWatching
  [b77e0a4c] + InteractiveUtils
  [4af54fe1] + LazyArtifacts
  [b27032c2] + LibCURL
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [1a1011a3] + SharedArrays
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [fa267f1f] + TOML
  [a4e569a6] + Tar
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll
  [deac9b47] + LibCURL_jll
  [29816b5a] + LibSSH2_jll
  [c8ffd9c3] + MbedTLS_jll
  [14a3606d] + MozillaCACerts_jll
  [4536629a] + OpenBLAS_jll
  [05823500] + OpenLibm_jll
  [83775a58] + Zlib_jll
  [8e850b90] + libblastrampoline_jll
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll
    Building ImageMagick → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/54dfa264804aefc44630c96619474e683a522d78/build.log`
Precompiling project...
MappedArrays
Reexport
HypertextLiteral
TiledIteration
Calculus
MosaicViews
DualNumbers
PlutoUI
Quaternions
FFTW
FFTViews
Colors
Rotations
Graphics
ColorVectorSpace
ImageCore
ImageShow
ImageMorphology
ImageMagick
ImageAxes
ImageDistances
ImageMetadata
ImageTransformations
ImageContrastAdjustment
ImageFiltering
ImageQualityIndexes
Images
  27 dependencies successfully precompiled in 26 seconds (63 already precompiled)
41.7 s
👀 Reading hidden code
20.8 μs
👀 Reading hidden code
img = load(download("https://user-images.githubusercontent.com/6933510/108605549-fb28e180-73b4-11eb-8520-7e29db0cc965.png"))
1.4 s
trygetpixel (generic function with 1 method)
👀 Reading hidden code
function trygetpixel(A::AbstractMatrix, i::Int, j::Int)
rows, cols = size(A)
if 1irows && 1jcols
A[i,j]
else
zero(eltype(img))
end
end
939 μs
trygetpixel (generic function with 2 methods)
function trygetpixel(A::AbstractMatrix, i::Real, j::Real)
trygetpixel(A, floor(Int, i), floor(Int, j))
end
👀 Reading hidden code
451 μs
map(CartesianIndices(img)) do I
new_coord = A \ collect(Tuple(I))
trygetpixel(img, new_coord...)
end
👀 Reading hidden code
1.0 s

1.0 0.0

0.0 1.0

👀 Reading hidden code
348 ms
2×2 Matrix{Float64}:
 1.0  0.0
 0.0  1.0
👀 Reading hidden code
16.2 ms