Commit da1807598e2d4c911f2bb297545f705e8ccd00c7
1 parent
d97f68bd
another draft of quantize implementation in Likely
Showing
1 changed file
with
13 additions
and
12 deletions
share/openbr/likely/face_recognition.tex
| ... | ... | @@ -18,18 +18,19 @@ As Likely is a literate programming language, this document is both the source c |
| 18 | 18 | |
| 19 | 19 | \section{Quantization} |
| 20 | 20 | \begin{likely} |
| 21 | -quantize-lo := data.min-element | |
| 22 | -quantize-hi := data.max-element | |
| 23 | -quantize-scale := (/ 255 (- quantize-hi quantize-lo)) | |
| 24 | - | |
| 25 | 21 | quantize := |
| 26 | - () :-> | |
| 27 | - src :-> | |
| 28 | - { | |
| 29 | - dst := (imitate-size src (imitate-dimensions u8 src.type)) | |
| 30 | - (dst src) :=> | |
| 31 | - dst :<- src.(- quantize-lo).(* quantize-scale) | |
| 32 | - } | |
| 22 | +{ | |
| 23 | + lo := data.min-element | |
| 24 | + hi := data.max-element | |
| 25 | + scale := (/ 255 (- hi lo)) | |
| 26 | + | |
| 27 | + src :-> | |
| 28 | + { | |
| 29 | + dst := (imitate-size src (imitate-dimensions u8 src.type)) | |
| 30 | + (dst src) :=> | |
| 31 | + dst :<- src.(- lo).(* scale) | |
| 32 | + } | |
| 33 | +} | |
| 33 | 34 | \end{likely} |
| 34 | 35 | |
| 35 | 36 | \section{Consolidated Algorithm} |
| ... | ... | @@ -38,7 +39,7 @@ The top level definition of the face recognition algorithm. |
| 38 | 39 | \begin{likely} |
| 39 | 40 | face-recognition := |
| 40 | 41 | { |
| 41 | - algorithm := (quantize) | |
| 42 | + algorithm := quantize | |
| 42 | 43 | src :-> |
| 43 | 44 | src.algorithm |
| 44 | 45 | } | ... | ... |