2/27/2007 How to Strip Redline Contours Out of an LTO map using Photoshop CS and paste them over a user's lunar photograph These instructions can be found in directory: http://members.csolutions.net/fisherka/astronote/Photometry/RedLineStrip/ These instructions are archived in that directory in file: RedLineStripping.txt There appears to be no built-in Photoshop filter for this process. This is a three part process. Here we will be using LTO78C2 (Madler) covering part of C. Theophilus as an example. This process is imperfect, but the best that I could come up with. First, you will crop the image. Then you will extract the contour line image into a blue channel and then into a redlined alpha channel layer. Then you will place your red alpha channel layer, registering it over a rectified user lunar photo. A) Make a cropped image from the source LTO map. Save as LTO78C2Cropped.jpg. Make safety backup of this cropped image. Reopen LTO78C2Cropped.jpg. B) Extract a visible blue channel layer that contains most of the contour line information. 1) Make a New Levels layer ( Layer | New Adjustment Layer | Levels ). Name the new Levels Layer "Blue Channel Layer". There is a four color channel control at the top of the Levels dialogue for RGB, R, G, and B. Select the "G" for Green channel and Green channel sliders for input and outpupt to zero input (suppress this channel). Do the same for the Red "R" channel. Suppress the channel entirely. 2) This leaves a blue channel layer. It will be an odd blue tinted color. Select the "B" channel option. Use the Blue channel input adjustment controls to narrow the input range to about 20 or 30 levels such that it maximizes the amount of contour lines and minimizes the amount of background. Just play with sliders until you get the best result. It is not possible to completely separate the contour lines from all dark background. 3) Save this result as a new Photoshop document (BlueChannel.psd) but keep the document open. C) Create an alpha channel layer containing the contour line information in black. 1) Make a new inverted (yellow) layer of the blue channel layer. Select the "Blue Channel Layer" on the Layers Palette that you created in the prior step. Now make a new inverted layer (Layers | New Layers Adjustment | Inverted). Name it the "Yellow Inverted Layer". This is a color separation mask. 2) Use Photoshop image math (Image | Calculations) to subtract the blue channel layer from the inverted blue layer, sending the result to an new external Photoshop document as an alpha channel. On the Calculations Dialogue make sure the first layer for an image math operation is set to the "Blue Channel Layer", the second operand is set to the "Yellow Inverted Channel" layer, and the operation is set to "Subtract". The destination should be a "New Document". Execute the image math operation. This will create a new Photoshop document with just the contour lines, colored black. 3) Save this new document naming it "AlphaChannel.psd". Note that the Save dialogue will force you to save the image as an Alpha Channel layer in Photoshop format. There is no way to save this image as jpg or png. 4) Close everything. D) Turn the alpha channel layer containing contours into a redlined jpg or psd document. Remember your new AlphaChannel.psd document contains the contour lines as black colored. Now you will turn them back into red contour lines. 1) Open a blank document. 2) Use "Place" to place the alpha channel contour document over the blank white background. 3) Open a new Color Balance layer (Layer | New Adjustment Layer | Color Balance Layer. Name the layer "Redlined". In the Color Balance dialogue there are options to separately set the color for shadows, mid-tones and higlights. For the shadows, mid-tones and highlights, separately set each red color to maximum. This will turn the black contour lines back into bright red contour lines. 4) Save the resulting redlined contour document as a Photoshop file and separately as a jpg image, e.g. AlphaChannelRedline.psd and AlphaChannelRedline.jpg 5) Close everything. E) Open a copy of your user lunar image and paste the redlined alpha channel document over the user image. 1) Open a copy of the user lunar image. 2) Use the "Place" feature to place the alpha channel redlined image (AlphaChannelRedline.jpg) over the user image. Do not immediately commit the Place action. 3) Make the contour redlined image transparent by: a) On the Layers Palette set the mode to Darken. b) Set the Fill to 30-50% This just makes the red contour line image temporarily transparent. Then you can see through the red contour lines to better register the contour image to features on the user photograph. 4) Now use Free Transform feature to register your redline contours over the user image. 5) Set Fill back to 100% after the image is registered and you have committed the Place action. Tip: The Navigator window and zooming and let you really get down to the fine images details to accurately register the contour lines over the user image. 5) Save the result as a Photoshop file and than as an image file for publication, e.g. jpg, png, etc. Note, parts this process can be saved as macros to speed future processing. Step B1 can be automated. Step B2 is manual. Steps B3 through D3 can be automated. Step D4 is manual. Step D5 can be automated but is really a manual closing step. K. Fisher fisherka@csolutions.net =========================== 2/24/2007 How to Strip Redline Contours Out of an LTO map and Paste the Contour Lines on to a User Lunar Image Photoshop probably is the better option. Not being at a computer with Photoshop or being a Photoshop guru, I'll explain a general process using AIP4WIN. But the steps can probably be replicated with any astronomical imaging program and certainly with PhotoShop. An example working directory containing the sample jpg files discussed below can be found at: http://members.csolutions.net/fisherka/astronote/Photometry/RedLineStrip/ These instructions are archived in that directory in file: RedLineStripping.txt It is assumed at you are working with a user image that is rectified show the LTO contour line orientation will match the user's lunar astrophotograph. A. Extracting the red lines from an LTO image: 1) Begin with a cropped sample from any LTO. Use the higher resolution 150 x 150 pixel LTO maps. The lower resolution 75 pixel LTO charts drop out too many of the redline pixels. Save the cropped result. - LTOCropped.jpg This is a three color RGB 255 level image. 2) Using the Color tool option, split the color layers into separate RGB channels. In AIP4WIN use the menu options Color - Color->RBG. Save the blue channel, which best captures the red lines, as a new JPG file - LTOBlueChannel.jpg Close files and reopen LTOBlueChannel.jpg. 3) Using the Image Display Control or any brightness or histogram filter routine, crop all pixel values between 151-255, removing those values. In AIP4WIN, do this by using the Image Control Display and set the low point to 0 and the high point to 150. Save this image - LTOBChannel0_150.jpg Close all images and reopen LTOBChannel0_150.jpg. 4) Now increase the color saturation of the image to bring out more detail in the contour lines. In API4WIN, using Color - Color Effect Tool - Saturation - Set Saturation to Maximum. Save file LTOBChannelSaturated.jpg Close and open LTOBChannelSaturated.jpg. 5) As a final step, convert this color image to a greyscale. In AIP4WIN, use the menu options Color - Greyscale. Save result as LTOLuminance.jpg . 6) I also find it useful to pixel crop this luminance image, this time retaining the black pixels levels 150-255. Save result as file LTOLuminance2.jpg. B. Putting a red overlay mask of contour lines over an existing lunar astrophoto using Photoshop CS. Again, I'm not at a Photoshop equipped computer. I'm going to do this from memory, so some of the steps may not be completely correct. 1) Open a working copy of your base user lunar image (a jpg, png, etc) in Photoshop. 2) Resave the file as PhotoShop file. 2) Duplicate the background layer. Set the duplicate background layer to "not active." 3) Use the "Place" option open the greyscale contour image - LTOLuminance2.jpg. You are creating a new saturation layer. Do not immediately use the "Commit" button. You will work this layer in Free Transform mode for the next few steps. 3A) Here's the counterintuitive part. On the Layers palette, change "Normal" to "Darken". Now in the normal everyday world, "Darken" means "darken the image." In black-arts underworld of Photoshop, "Darken" means "make the background of the image transparent." As a PhotoShop novice, I'd always look an image option labeled "Darken" to make an image background transparent. -:) Go figure? 3B) Use the Opacity and Fill controls on the Layers platte to make the lines stand out and the background fade to taste on the contour line layer. Here you are just temporarily setting Opacity and Fill to make the contour lines semi-transparent, so you can see the base lunar image through the contour line layer in order to scale and register the contour line image to the base image. 3C) Now complete using the Free Style Transform control buttons to scale and register the layer containing the contour lines over your base astrophoto image. I found it useful to do three-point registration by including three widely-spaced hill features seen in the base image that have three corresponding contour peaks on the contour line image. None of the three features should be on the same row or column. Just scale the image so the three contour line peaks correspond to the base lunar image. The same can be done with three small craters. Also note that if the user lunar image is not completely rectified with complete accuracy, the PhotoShop CS Free Style Transform tool has a "Perspective" option. In Free Style Transform mode, right-click the image. A pop-up menu will have the Perspective option. This allows you to scale and register the flat contour line plane in 3 dimensions. I haven't tried this, but mention it here only for completeness. 3D) Set the Opacity and Fill levels on the contour line layer to 100%. Again, remember that the contour layer display (on the Layers palette) must be set from Normal to Darken, in order to keep the background of the contour layer to remain transparent, just showing the foreground contour lines. 3E) Hit the "Commit" button to fix the changes to the contour layer. 4) On the Layers palette, make sure the contour layer is active and background layers are inactive. 5) On the Styles palette, there is Style tool labeled "Red". This will make the contour layer lines red. Remember that the contour layer display (on the Layers palette) must be set from Normal to Darken, in order to keep the background of the contour layer transparent, just showing the foreground contour lines. 6) Save your Photoshop file to preserve these working changes. 7) Now use Save As to export your final image with the contour overlay back into a jpg file. Although not the same working example as shown above, in the example directory is file LTOwUserOverlay.jpg. This shows a small excerpt from an LTO image, where I have pasted a user generated contour map back over the base lunar astrophotograph. This was done using PhotoShop and the process described above. Hope that helps and that I've remembered all the PhotoShop steps correctly. - Kurt K. Fisher fisherka@csolutions.net