home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / a / aim / !aim / macros / demosch < prev    next >
Text File  |  1990-10-13  |  5KB  |  143 lines

  1. * Analysis of electronic scheme 
  2. * by Cellular Logic Operations 
  3. * Frans Groen
  4. *
  5. readf scheme,A
  6. @_corshad   * correct the image for shading
  7. * obtain from the corrected image
  8. * a binary image by thresholding
  9. thresh B,B,1,220    * threshold
  10. toff
  11. doff        * display off
  12. bcop 1,8    * copy the thresholded image
  13. bcop 1,6    * original in green
  14. inv 6       * after inversion
  15. *
  16. * separation of drawing and text
  17. *
  18. *
  19. * fill small holes
  20. bcop 8,7,b,b       * copy bitplane
  21. don
  22. erosion 1,8,4,0,b  * erode small holes away
  23. prop 511,8,7,8,0,b * propagate for what remains
  24. inv 8              * cleaned drawing in red
  25. don,4              * multi-bitplane display on
  26. bcopy 8,5,b,b      * save original in b5
  27. doff               * display off
  28. *
  29. * make skeleton
  30. skelet 511,8,1,b   * skeleton in b8
  31. don                * single bitplane display
  32. bcopy 8,4          * save skeleton in b4
  33. *
  34. * shave skeleton
  35. bcopy 8,7,b,b       * copy in b7
  36. -skelet 16,7,1,b    * remove strokes of length 16
  37. exor 8,7,7,b        * find strokes
  38. vertices 8,0,b      * vertices in bitplane 3
  39. dilation 1,8,8,0,b  * enlarge vertices
  40. propag 511,8,7,8,0,b * propagate vertices in strokes
  41. exor 4,8,8,b        * cleaned object in b8
  42. bcopy 8,4           * save in b4
  43. *
  44. * separate text based upon vertices in 
  45. * the skeleton with removed strokes
  46. bcopy 8,7            * copy for propagation mask
  47. vertices 8,0,b       * find vertices
  48. propag 511,8,7,8,0,b * propagate vertices in skeleton
  49. bcop 8,4,b,b         * save cleaned skeleton in b4
  50. propag 511,8,5,8,0,b * propagate skeleton in drawing
  51. doff                 * display off
  52. reset 7              * reset for display
  53. don,4                * multi-bitplane display 
  54. bcop 8,5             * save original in b5
  55. *doff                 * display off 
  56. *
  57. *analyse objects
  58. *capacitors : big objects
  59. bcop 5,6            * original in b8
  60. ero 4,6,4           * find capacitors
  61. prop 4,6,5,8,0,b    * propagate back
  62. *  capacitors in b6
  63. *resistors : objects enclosing small holes
  64. don,4
  65. inv 5,b             * invert
  66. bcop 5,7            * original in b7
  67. ero 5,7             * erode 5 times
  68. propag 511,7,5,8,0,b * find what remains
  69. exor 5,7,7,b        * find what disappears
  70. *  resistors in b7
  71. * opamps
  72. bcop 5,8
  73. erosion 7,8,8,0,b   * erode 7 times
  74. propag 511,8,5,8,0,b * find what remains
  75. exor 5,8,8,b        * and what disappears
  76. exor 7,8,8,b        * removes the resistors
  77. doff
  78. *  opamps in b8
  79. * finds location of components in scheme
  80. *   extend opamps
  81. dilation 2,8,6,0,b * extend opamps  
  82. bcopy 8,1,b,b      * save seed bitplane
  83. propag 3,8,4,6,0,b * propagate in skeleton
  84. or 1,8,8,b         * or seed bitplane
  85. bcopy 8,1,b,b      * opamps in b1
  86. * extend resistors
  87. dilation 2,7,6,0,b * extend resistors
  88. bcopy 7,2,b,b      * save seed bitplane
  89. propag 3,7,4,6,0,b * propagate in skeleton
  90. or 2,7,7,b         * or seed bitplane
  91. bcopy 7,2,b,b      * resistors in b2
  92. * extend capacitors
  93. bcopy 6,3,b,b      * save seed bitplane
  94. propag 3,6,4,6,0,b * propagate capacitors in skeleton
  95. or 3,6,6,b         * or seed bitplane
  96. don,4              * multi-bitplane display on
  97. bcopy 6,3,b,b      * capacitors in b3
  98. * determine endpoints and branchpoints
  99. * find scheme without components
  100. bcop 4,8         * get cleaned drawing (b4)
  101. inv 8            * invert
  102. or 1,8,8         * get rid of opamps
  103. or 2,8,8         * resistors
  104. or 3,8,8         * capacitors
  105. inv 8            * drawing without components
  106. bcopy 8,6        * copy in b6 for vertices
  107. bcopy 8,7        * copy in b7 for endpixels
  108. * find endpixels of the components
  109. endpix 7,0,b     * find endpixels
  110. dilation 2,7,6,0,b * extend endpixels
  111. * find vertices
  112. vertices 6,0,b
  113. dilation 2,6,6,0,b
  114. *
  115. *dilate lines because of low_res display
  116. dilation 1,8,6,0,b
  117. or 6,8,8
  118. or 7,8,8           * lines    :        876.....
  119. exor 8,6,6         * vertices :        87......
  120. exor 8,7,7         * endpixels:        8.6.....
  121. * insert components
  122. or 1,8,8           * opamps   :        8......1
  123. or 2,7,7           * resistors:        .7....2.
  124. or 3,6,6           * capacitors:       ..6..3.. 
  125. reset 5 b
  126. gdisp b
  127. * Change the colours, using don,5 display mode 
  128. * (Ed Doppenberg 5-8-90)
  129. clear c
  130. bcopy 1 5 b c   * copy op.amp in bit plane 5 (red)
  131. bcopy 2 2 b c   * copy resistors in bit plane 2 (blue)
  132. bcopy 3 3 b c   * copy capacitors in bit plane 3 (green)
  133. bcopy 6 4 b c   * copy vert.+horiz.+cap. bit plane 4 (l.blue)
  134. exor 3 4 4 c    * strip capacitors
  135. bcopy 7 7 b c   * copy endpoints + vert+horizon in bit plane 7 (yellow)
  136. exor 4 7 7 c    * strip,
  137. and 4 7 7 c     * every thing execpt endpoints
  138. exor 7 4 4 c    * strip endpoints 
  139. don,5
  140. gdisp c
  141. don 1           * back to normal display mode
  142.