home *** CD-ROM | disk | FTP | other *** search
/ Really Useful CD 1 / ReallyUsefulCD1.iso / extras / graphics / aim / _aim / macros / demtable1 < prev    next >
Encoding:
Text File  |  1990-08-31  |  3.3 KB  |  150 lines

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