Commit da1807598e2d4c911f2bb297545f705e8ccd00c7

Authored by Josh Klontz
1 parent d97f68bd

another draft of quantize implementation in Likely

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 +18,19 @@ As Likely is a literate programming language, this document is both the source c
18 18
19 \section{Quantization} 19 \section{Quantization}
20 \begin{likely} 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 quantize := 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 \end{likely} 34 \end{likely}
34 35
35 \section{Consolidated Algorithm} 36 \section{Consolidated Algorithm}
@@ -38,7 +39,7 @@ The top level definition of the face recognition algorithm. @@ -38,7 +39,7 @@ The top level definition of the face recognition algorithm.
38 \begin{likely} 39 \begin{likely}
39 face-recognition := 40 face-recognition :=
40 { 41 {
41 - algorithm := (quantize) 42 + algorithm := quantize
42 src :-> 43 src :->
43 src.algorithm 44 src.algorithm
44 } 45 }