home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / biberb2.zip / readme.txt < prev   
Text File  |  2002-04-05  |  10KB  |  227 lines

  1. This is the second beta release of the Bibertools, an add-on package for 
  2. ImpOS/2 2.x. The name, bibertools, is an abbreviated form of 
  3. "BIldBEaRbeitungs-Tools" (image processing tools). Maybe not very imaginative, 
  4. but I tried to find a name that hasn't been used before.
  5.  
  6. PLEASE read the file DANGER.TXT!
  7.  
  8. PURPOSE
  9. I created this program because I want to scan a large number of slides. ImpOS'
  10. own image processing tools are not really up to the job, and I wanted 
  11. an interface that would give me access to the most often needed processing
  12. options via a single mouse click. I also wanted to have a tool that would
  13. automatically generate the necessary file names, keep track of the names used,
  14. and save the images to a predefined location without asking unnecessary 
  15. questions.
  16.  
  17. I finally found out how to 'invert' negative film material. The problem was 
  18. how to remove the orange mask and restore proper RGB-balance. For the solution, 
  19. see below.
  20.  
  21. REQUIREMENTS
  22.  
  23. You need IMPOS/2 version 2 or higher. You also need the following programs:
  24.  
  25. pnmarith.exe, ppmnorm.exe, pnmgamma.exe pnmcrop.exe, pnmflip.exe, 
  26. and several support dlls; they van be obtained from the file NETPBMA.ZIP,
  27. which is available at the following URLs:
  28.  
  29. ftp://ftp.leo.org/pub/comp/os/os2/leo/graphics/netpbma.zip
  30. ftp://hobbes.nmsu.edu/pub/os2/dev/mm/netpbma.zip
  31.  
  32. INSTALLATION
  33.  
  34. Copy the included files to a common directory; you can put them into the 
  35. IMPOS directory, if you want, otherwise you will need to add the IMPOS 
  36. directory to your PATH and LIBPATH statements in CONFIG.SYS. 
  37.  
  38. Copy the files from NETPBMA to a directory on your HD, and add this directory 
  39. to your PATH and LIBPATH statements in CONFIG.SYS.
  40.  
  41. You might also want to set the BIBERTEMP variable in CONFIG.SYS, eg.
  42. SET BIBERTEMP=D:\TEMP. This variable sets the directory where the temporary
  43. files are stored. Set this to your fastest drive. 
  44.  
  45. Create a program object for BIBER.EXE.
  46. Create a program object for HISTOGRAM.EXE
  47.  
  48. Reboot.
  49.  
  50. RUNNING BIBERTOOLS
  51.  
  52. Start BIBER.EXE from the program object that you created before. It should 
  53. bring up IMPOS automatically. If it doesn't, something is probably wrong
  54. with your path and/or libpath statements. 
  55.  
  56. HISTOGRAM.EXE can also be started from the program object, but it will only 
  57. run if an image is loaded in IMPOS. If it doesn't find an image to operate 
  58. on, it will inform the user and then terminate.
  59.  
  60. The histogram tool may need some explanation. It takes the RGB values of all 
  61. image pixels and counts how often (-> y-axis) each of the 256 possible 
  62. intensity levels (-> x-axis) occurs. With an average, well-exposed slide, 
  63. the red, green, and blue curves would look roughly similar, and they would all 
  64. fill the whole range from 0...255. Underexposed images would have their 
  65. histograms shifted to the left, and overexposed images would appear shifted to 
  66. the right. You have several options in this dialog: If you klick on any of the 
  67. "auto" buttons, the brightnesss levels in the corresponding R, G, or B 
  68. sub-picture will be redistributed to fill the whole range from 0 to 255. You 
  69. can repeat that for the other colors, if you want. The "reset" button resets 
  70. all three sub-images and reloads the corresponding histograms. 
  71.  
  72. The "auto" remapping is fast, but it lacks flexibility. Therefore, you can 
  73. set the min and max values for each color manually, either by entering the 
  74. numeric values, or by double-clicking in the black bar beneath each histogram.
  75. A double-click with the left mouse button sets the 'min' value, and a double-
  76. click with the right mouse button sets the 'max' value.
  77.  
  78. OPTIONS
  79.  
  80. The NETPBM programs operate on the disk: They read a file, and write their 
  81. output to another file. The BIBERTOOLS store these temporary files in the 
  82. path which is defined by the BIBERTMP environment variable. If that doesn't 
  83. exist, they look for the TMP variable, and if that doesn't exist then for 
  84. the TEMP environment variable. If you have the RAM, then it is strongly 
  85. recommended to set the temporary directory to a RAM disk. I tried RAMFS64, 
  86. but that was much slower than my HD. However, in March 2002, a performance-
  87. optimised RAMFS64P.IFS written by Andrew Belov <andrew_belov@newmail.ru>
  88. was announced in one of the OS/2 newsgroups, and this is really fast, and 
  89. the BIBERTOOLS work nicely with the BIBERTMP directory pointing to the
  90. RAMFS64P RAM disk. 
  91.  
  92. NEGATIVES
  93.  
  94. I finally found out how to remove the orange mask from scanned color 
  95. negatives, and the "negative" function is fully functional in the present 
  96. release. When the program is started, it looks for *.film files in its own
  97. directory. If any files are found, they will be listed in the drop-down list
  98. box to the right of the "negative" checkbox. The *.film files are used to 
  99. define and store some (fifteen) characteristic parameters of a given film 
  100. material, and you should select the correct *.film file for best results.
  101. Each film file contains a 3x3 matrix 
  102.  
  103. RR RG RB
  104. GR GG GB
  105. BR BG BB
  106. which describes the cross-sensitivity of the film material: In the simplest 
  107. case, all diagonal elements of the matrix are equal to one, and all 
  108. off-diagonal elements are equal to zero:
  109.  
  110. 1 0 0
  111. 0 1 0
  112. 0 0 1
  113.  
  114. This matrix describes an ideal fim material, where the "red" layer is only 
  115. sensitive to red light (RR=1), the "green" layer to green (GG=1), and the 
  116. "blue" layer to blue (BB=1). The "red" layer is neither sensitive to green 
  117. light (RG=0), nor to blue light (RB=0), and so on.
  118.  
  119. In most cases, you will be able to get along with the simple unity matrix, 
  120. but if you need more, the program can deal with it. However, in order 
  121. to keep the code simple and efficient, there are some limitations. In 
  122. particular, the program can only deal with parameter sets satisfying 
  123. the following requirements:
  124.  
  125. RG/(RR + RB + RG) < 0.5
  126. RB/(RR + RB + RG) < 0.5
  127. GB/(GR + GB + GG) < 0.5
  128. GB/(GR + GB + GG) < 0.5
  129. BB/(BR + BB + BG) < 0.5
  130. BB/(BR + BB + BG) < 0.5
  131.  
  132. In other words, the off-diagonal elements must not be too big compared
  133. to the on-diagonal elements. This is only a limitation if you want to
  134. (mis-)use the function to generate false color images. It should not
  135. affect the normal use. 
  136.  
  137. Note that the inversion algorithm normalises the output to 256 grayscales,
  138. independent on the matrix. Therefore, the above unity matrix produces the 
  139. same result as a matrix
  140.  
  141. i 0 0
  142. 0 j 0
  143. 0 0 k
  144.  
  145. with arbitrary values i, j, k (not equal to zero).
  146.  
  147. There are two more lines (with three parameters per line) in each film 
  148. file, and they are much more important. They each consist of three 
  149. integer numbers between 0 and 255, separated by one or more spaces:
  150.  
  151. R0 B0 G0
  152. R1 B1 G1
  153.  
  154. R1, B1 and G1 are the red, green and blue values of the orange mask of
  155. the negative film, as seen by the scanner. In other words, they are 
  156. RGB values of a completely unexposed part of the film, or the 
  157. brightest parts of the negative. They will be mapped to black in the
  158. final (positive) image. 
  159. R0, G0, and B0 are the red, green and blue values of a part of the 
  160. film that has been exposed to saturation, ie. the darkest possible 
  161. pixels. They will be mapped to white in the final (positive) image.
  162.  
  163. As I said before, these latter parameters are much more important 
  164. for the final result than the previously described nine "matrix" 
  165. parameters. Fortunately, it is relatively easy to find their 
  166. correct values for any given film material, provided that you have a
  167. few exposed negatives. Here's the recipe:
  168.  
  169. (a) Find and scan an image that has both very bright and very dark 
  170. areas.
  171. Typically, that could be a photograph of a landscape, with white 
  172. houses or clouds and a few dark shadows. If there are no sufficiently 
  173. dark shadows, you can shift the image by millimeter or two in the 
  174. film holder and use the space between two exposures on the film
  175. stripe: That is always unexposed, and gives a perfect R0,B0,G0 
  176. level.
  177.  
  178. (b) Load the image into IMPOS and start the "histogram" tool that 
  179. comes with the BIBERTOOLS package. Please use the separate tool; you cannot 
  180. use the histogram function of the scan module for this purpose. 
  181.  
  182. (c) For each of the three (R, G and B) histograms, do a 
  183. double click with the left mouse button on  the black bar below the
  184. left boundary of the curve, and a right MB double click below the 
  185. right boundary of the curve. This defines the R, G, and B range that will be 
  186. mapped to the full available range (0...255) in the inverted images.
  187.  
  188. (d) In the histogram tool, select 'File' -> 'Create *.film file', enter a file
  189. name, and click on 'OK'. 
  190.  
  191. (e) Scan and invert a few negatives using the new film file, and check 
  192. that you got everything right. 
  193.  
  194. (f) I don't know any straight-forward way to create an optimised 
  195. transfer matrix. You will have to fiddle around with the off-diagonal 
  196. elements and compare the results to find the best set of parameters. 
  197. If someone knows a better solution, suggestions are welcome.
  198.  
  199. FEEDBACK, QUESTIONS, ETC.
  200.  
  201. If you have problems, feel free to contact me, either via e-mail, or write me
  202. a short note in the comp.os.os2.* newsgroups. You will usually find me there
  203. (not in co.o.o.advocacy though). 
  204.  
  205. Note that I have news and mail filters installed. News and mail messages from
  206. notoriously annoying people may not get through. They may still ask someone 
  207. else to contact me.
  208.  
  209. LICENCE
  210.  
  211. You may do with this program whatever you want. I do not charge you anything,
  212. and I cannot be held liable for any damage. If you are interested in the source 
  213. code, contact me. It's VisPro REXX code, therefore you will need VisPro REXX 
  214. to do anything useful with it. I tested the basic image inversion code in a 
  215. separate REXX file which requires only the NETPBMA modules (VisPro REXX not 
  216. required). This is also available on request. 
  217.  
  218. CONTACT
  219.  
  220. My current mail adress is
  221.  
  222. Manfred.Agne@netsurf.de
  223.  
  224. It might change in 2002 - you'll find me easily via Google groups.
  225.  
  226. Manfred Agne
  227.