home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / a / aim / !aim / macros / demtable < prev    next >
Text File  |  1991-03-26  |  4KB  |  160 lines

  1. * @demtable demonstrates the table command in (normal) display mode 1.
  2. * table: transforms a grey value image using a look-up table.
  3. *
  4. * The grey value g from the input image (first parameter) is used 
  5. * as table address,  the content found there becomes the grey value 
  6. * h in the output image (second parameter).
  7. don 1
  8. shad a
  9. copy a b 1 1 0 1 1 0 
  10. *transposed
  11. * Several tables can  be generated (third parameter, t):
  12. * t=0: (h/255)=(g/255)**(j/k);    
  13. table a d 0 1 2  
  14. * j/k=1/2, power, square root 
  15. add b d 
  16. th d d 1 127
  17. table a d 0 2 1  
  18. * j/k=2/1, power, square 
  19. add b d 
  20. th d d 1 127
  21. * t=0: (h/255)=g**(j/k), for j/k<0 different scaling: g instead of g/255;    
  22. table a d 0 -1 1  
  23. * j/k=-1/1, neg.power 
  24. add b d 
  25. th d d 1 127
  26. * t=2: (h/255)=(k/g)**j;
  27. table a d 2 1 1  
  28. * 255/g, reciprocal 
  29. add b d 
  30. th d d 1 127
  31. * t=1: (h/255)=(j/k)**((g/255)-1);   j=0 -> j/k=e;
  32. table a d 1 10 1  
  33. * exponential, base 10 
  34. add b d 
  35. th d d 1 127
  36. table a d 1 0 1  
  37. * exponential, base e 
  38. add b d 
  39. th d d 1 127
  40. * t=-1: (h/255)-1=log(g/255)/log(j/k); 
  41. table a d -1 10 1 1 
  42. * logarithm, base 10 
  43. add b d 
  44. th d d 1 127
  45. table a d -1 0 1 1 
  46. * logarithm, base e 
  47. add b d 
  48. th d d 1 127
  49. * t=3: pi2 (h-127-j)/127=atan((k/100) pi2 (g-127)/128  - tan(pi2 j/127)); pi2=pi/2;
  50. * t=3:      h           =atan((k/100)      g           -  (k/100) gj   );    
  51. table a d 3 0 100 1
  52. * arctangent S-curve
  53. add b d 
  54. th d d 1 127
  55. * t=-3: pi2 (h-127)/128=(tan(pi2 (g-127-j)/127)+tan(pi2 j/127)) /(k/100); pi2=pi/2;
  56. * t=-3:      h         =(tan     (g    -j)     +   (k/100) gj ) /(k/100);
  57. table a d -3 0 100 1
  58. * tangent inverse S-curve
  59. add b d
  60. th d d 1 127
  61. * t=4: g=(x+8)+16*(y+8)->h=phi*16/2pi+16*r;
  62. cdiv a 16 c *steps x-axis 0 1 2 ... 15
  63. cdiv b 16 d 
  64. cmul d 16   *steps y-axis 0 16 32 .. 240
  65. sub d c 15 d  *0+15 0+14 .. 0+0, 16+15 .. 16+0 ,, 240+15 .. 240+0
  66. table d c 4  
  67. cdiv c 16 d
  68. cmul d 16 
  69. sub c d 0 c
  70. * cartesian to polar
  71. add d c  
  72. * t=-4:  inverse of t=4;
  73. table c d -4  
  74. * polar to cartesian
  75. cdiv d 16 c 
  76. cmul c 16
  77. sub d c 0 d
  78. * t=5: (h-127)/127=cos((g/255)**(j/100) *k*2pi);
  79. * t=5:  h         =cos(      g**j       *k*2pi);
  80. table a d 5 100 1 
  81. * cosine
  82. add b d 
  83. th d d 1 127
  84. table a d 5 200 5 
  85. * chirped cosine
  86. add b d 
  87. th d d 1 127
  88. * t=-5: (h-127)/127=sin((g/255)**(j/100) *k*2pi);
  89. * t=-5:  h         =sin(      g**j       *k*2pi); 
  90. table a d -5 100 1 1
  91. * sine
  92. add b d 
  93. th d d 1 127
  94. table a d -5 200 5 1
  95. * chirped sine
  96. add b d 
  97. th d d 1 127
  98. * t=6: 8 thresholds j,j+k,,j+7k;
  99. table a d 6 30 20 1
  100. bd d 1 * thr 30
  101. bd d 2 * thr 50
  102. bd d 3 * thr 70
  103. bd d 4 * thr 90
  104. bd d 5 * thr 110
  105. bd d 6 * thr 130
  106. bd d 7 * thr 150
  107. bd d 8 * thr 170
  108. * t=-6: j=lower, k=higher threshold;
  109. table a d -6 85 170 1
  110. add b d
  111. th d d 1 127
  112. * t=7: (h-127)/127=-log( (254/g)-1 )/log(253); 
  113. table a c 7 
  114. * symmetric logarithm, log( (254/g)-1 ) = log(254-g)-log(g);
  115. add b c d
  116. th d d 1 127
  117. * t=-7: (254/h)-1= exp( -((g-127)/127) log(253) );
  118. table c d -7 
  119. * inverse of symmetric logarithm
  120. add b d 
  121. th d d 1 127
  122. * t=8: (h/255)=( a**(g/255) + a**(-g/255) -2) / (a+1/a-2); a=j/k;
  123. table a d 8 0 1 
  124. * cosinus hyperbolicus -1, base e 
  125. add b d 
  126. th d d 1 127
  127. * t=-8: (h/255)=log( (g/255) +1 + sqrt( ((g/255) +1)**2-1) ))/log(j/k); 
  128. table a d -8 0 1  
  129. * inverse of cosh-1, base e 
  130. add b d 
  131. th d d 1 127
  132. * Fourth para.(r) reflects table: r=1: normal, default;
  133. table a d 0 2 1 1 *square 
  134. add b d 
  135. th d d 1 127
  136. * r=2: g->-g;
  137. table a d 0 2 1 2
  138. add b d 
  139. th d d 1 127
  140. *  r=3: g->-g, h->-h;
  141. table a d 0 2 1 3
  142. add b d 
  143. th d d 1 127
  144. * r=4: h->-h; 
  145. table a d 0 2 1 4
  146. add b d 
  147. th d d 1 127
  148. * r=5: g->|g|; 
  149. table a d 0 2 1 5
  150. add b d 
  151. th d d 1 127
  152. * r=6: g->|g|, h-> |h|*sgn(g),
  153. table a d 0 2 1 6
  154. add b d 
  155. th d d 1 127
  156. * r<0: h->h+r[mod256].
  157. table a d 0 2 1 -16
  158. add b d
  159. th d d 1 127
  160.