Functors, Comonads, and Digital Image ProcessingJUSTIN LE, CHAPMAN UNIVERSITY SCHMID COLLEGE OF SCIENCE AND TECHNOLOGY
Categories
Objects Morphisms
Composition
โค โ
โ(people)
(integers)
(real numbers)
๐๐๐ข๐๐ :โโโค
๐๐๐ :โโโ
๐๐๐ข๐๐โ๐๐๐ :โโโค(๐๐๐ข๐๐โ๐๐๐) (๐ )=๐๐๐ข๐๐ (๐๐๐ (๐ ))
๐ฎSet
Ex: Infinite List Functor
๐ฟ ( ๐ )=๐โ
X to infinite lists of things in X
92 4, 9, 8, 75, -3, ...โโค โ๐ฟ(โค)
๐ : ๐โ๐๐ฟ ( ๐ ) :๐ฟ(๐ )โ๐ฟ(๐ )
Comonads1. Extract 2. Duplicate 3. Laws , etc.
๐ ([ 4 ,9 ,8 ,75 ,โ3. .])=4 ๐ฟ ([4 ,9 ,8 ,75 ,โ3. .])=?? ?
Infinite List Functor
Cokleisli Arrows
๐ :๐ ( ๐ )โ๐ ๐ :๐ (๐ )โ๐
๐โ ๐ :๐ (๐ )โ๐Comonads only!
Functor 1: โImage with Focusโ
๐ผ ( ๐ )=โค2ร ๐โค2
5 ((5,2 ) ,[โฑ โฎ โฎ โฎ โฐโฏ 7 3 19 โฏโฏ 22 4 120 โฏโฏ 8 79 1 โฏโฐ โฎ โฎ โฎ โฑ
])โโ โ ๐ผ (โ)
Position-Aware Transformation
[0 โ1 ๐ค1 0 00 0 1 ]
Affine Transformation Matrix
๐ผ (โ )โโ
๐ ,๐
๐ผ ๐ ,๐ผ๐
๐ โ๐
๐ผ ๐ โ๐ผ๐=๐ผ ๐ โ๐
Compose Affine
Compose Cokleisli
EncodeEncode
Functor 2: โLocal Neighborhoodโ
G
5 [โฑ โฎ โฎ โฎ โฐโฏ 7 3 19 โฏโฏ 22 4 120 โฏโฏ 8 79 1 โฏโฐ โฎ โฎ โฎ โฑ
]โโ โ๐บ(โ)
Local/Relative Transformations
[ 0 โ1 0โ1 5 โ10 โ1 0 ]
Kernel/Convolution Matrix
[โฑ โฎ โฎ โฎ โฐโฏ 7 3 19 โฏโฏ 2 5 6 โฏโฏ 8 1 9 โฏโฐ โฎ โฎ โฎ โฑ
] 13โค๐บ (โค)
๐ ,๐
๐ ๐ ,๐ ๐
๐ โ๐
๐ ๐ โ ๐ ๐=๐ ๐ โ๐
Convolve Kernels
Compose Cokleisli
EncodeEncode
Extensions of I are Decoded Filters
๐ : ๐ผ ( ๐ )โ๐ ๐ โ : ๐ผ (๐ )โ ๐ผ (๐ )
๐ โ : ๐โ2
โ๐โ 2
Classical image filter
focus stays same
Commutation Abounds
๐ ,๐
๐ โ ,๐โ
๐ โ๐
๐ โโ๐โ= ( ๐ โ๐)โ
Compose Cokleisli
Compose Normally
Extend Extend
Decoded Neighborhoods
๐ :๐บ ( ๐ )โ๐
ฮ ( ๐ ) : ๐ผ ( ๐ )โ๐
โGlobalizationโ,
ฮ ( ๐ )โ : ๐โ2
โ๐โ2
Classical image filter
๐ ,๐
ฮ ( ๐ )โโ ฮ (๐ )โ
ฮ ( ๐ โ๐ )โ
(ฮ ( ๐ )โฮ (g ) )โGlobalize, extend, compose
Cokleisli compose, globalize, extend
Globalize, cokleisli compose, extend
Extension, Globalization are CheapโขWritten once: less bugs
โขOptimize once, unlimited return on performance
โขTrivially parallelizable
โขGlobalization can handle boundary conditions, low-level
Generalization
๐ผ๐ (๐ )=โค๐ร๐โค๐
๐บ๐ ( ๐ )=๐โค๐
n Application1 Audio, Time signals
2 Images
3 Video
1000+ Difference Equations