Friday, May 2, 2014

Point and Shoot Photomicrography

There have been several postings showing how Russian photographer Alexey Kljatov used some tape, a point and shoot camera, and an old 35mm film camera lens to build a wonderful photomicrography setup.  (described in http://www.boredpanda.com/snowflake-macro-photography-diy-alexey-kljatov/).  I had spent quite a bit of time over the past three winters trying to capture snowflakes the hard way (using a microscope with a camera attachment).  The problem with a microscope setup is that it must be allowed to cool down so that the stage will not melt the specimens.  The beauty of Alexey's setup is that the auto-focus for the point and shoot camera could be used!  Another thing he points out is that using the time delay on the shutter will eliminate most camera "jiggle" problems.  I set mine to 2 second delay and it seems to work well.

To improve on his design, I realized that a neoprene plumbing connector could be used to build the light-tight fitting necessary to align the 35mm film camera lens to the point and shoot camera.  For my setup I used a Canon SX160  point and shoot camera ($59.99) and a Canon 50mm lens from an old film camera I no longer use.  The 50 mm lens must be mounted reversed in front of the SX160 lens, and there must be clearance so that the point and shoot can be set to maximum telephoto (16X in this case; ~80mm fl).  The three components are held together using simple ring clamps as shown below:


The final configuration is shown in the next photo.


Note that you are seeing the back of the lens from the 35mm film camera!

There are several ways to get the subject in the proper range for the autofocus to work.  One simple way is to use a glass plate with blocks to elevate it such that the subject will autofocus when the camera is simply placed with the lens on the plate.  The samples can then be shifted around under the glass plate, or the camera can be slid to the proper place on the plate.

A better way is to use a tripod that allows you to invert the head (so that the camera is mounted inside the tripod).  This is the technique I used, as shown in the figure below.


The nice thing about this setup is that if you are wanting to try snowflake photography, you can leave the camera and tripod in the warm house until you find nice snowflakes and then bring it out for the photography!

Here are some examples of snowflakes taken during the past winter:









I especially like the column snowflake in the last image.  You will note that the major problem you will encounter is that while the camera will auto focus, the depth of field is so shallow that even a slight tilt will result in out of focus areas.

Don' be afraid to try things other than snowflakes!


Saturday, July 27, 2013

Scanning B & W Negatives

One of the things I inherited from my father was his collection of photographs, including black and white images, color images, slides and thousands of negatives.  It was straight-forward to scan in the images, but the slides and negatives were problematic.  Over the years I have used specialized 35mm slide scanners and several flat-bed scanners that were designed for negative scanning.  Unfortunately, for inexpensive scanners the drivers for scanning negatives typically only handle 35mm and one or two other smaller formats, while my negatives included all sizes (my father must have owned a dozen cameras--all different!).

I finally decided that the primary difference between scanning a photo vs. negative on my Canon scanner is that with negatives there was an auxiliary light built into the cover that followed the scan.  With that in mind I tried scanning negatives by placing them under a glass plate with a light above them.  With a bright enough light it was *almost* possible to  get a decent copy.  After considerable trial and error I came up with the following, which works beautifully (IMHO).

I purchased two pieces of window glass that would just fit the glass in the scanner (for the Canon 8600 that is 8.5 x 11.5 inches).  I used clear tape to fasten the glass plates together so that they could be opened like a book (I fastened the short side), and used a small piece of tape to create a tab that allowed me to easily lift the "negative holder" from the scanner.  The bright light was easy--the sun!  I removed the top from the Canon and placed it on a small table in direct sunlight.  After experimenting for several days I found that a piece of translucent white plastic (salvaged from an old slide viewer) placed over the negative holder gave the best results with razor sharp scans.


I set the scanner to "Grayscale" and saved the images in TIFF format.  Keep in mind that you probably will want to use a high resolution scan (I was using 800 dpi for most of my work).  Using 800 dpi or higher will require a significant amount of memory and will require long scan times.  I constructed a second negative holder  so that I could load one while the other was scanning.

After scanning I used Photoshop to invert the negatives and rotate and crop them.

Below is the "raw scan" for a selection of negatives of different sizes and the final image for one of the images (this one was done at 600 dpi).


Happy scanning!

Wednesday, July 13, 2011

Hugin from scratch (for Windows 7)

One of the most powerful panorama stitching programs is freely available and (for the most part) easy to use.  This "tutorial" is a step-by-step guide on how to install Hugin and generate your first panorama.  There are several url's that will prove useful as you work with Hugin, and I list them here for convenience:
   http://hugin.sourceforge.net/ is the home page for the Hugin open-source project
   http://hugin.sourceforge.net/tutorials/index.shtml is the home page for various tutorials on how to use Hugin
   http://sourceforge.net/projects/hugin/files/hugin/hugin-2011.2_beta/ for those brave enough to want to try the very latest beta software.
I actually recommend that you do not use the beta software until you become familiar with the program.  I list it only because the following tutorial was done with the beta software.  The most recent stable version (available at the first link) is Hugin-2011.0.

What does Hugin do?  Primarily, it allows you to stitch together a large number of overlapping photographs to generate one single image.  In the extreme it allows images such as the following "spherical" panorama of the lobby of my local public library.


This panorama, reduced for this writeup, is 18,000 pixels wide and and consists of over 70 individual photographs!  Don't expect to be able to duplicate this type of work immediately, but with a little practice you will soon be generating some amazing images!

The best way to learn how to use the program is to just jump in and do it!  I have six images, show below, that I will stitch together to yield the panorama at the bottom.


Part 1.  Downloading and Installing Hugin
The safe way to proceed is to go to the Hugin sourceforge page (http://hugin.sourceforge.net/) and click on the link "Download".  From the download page go to the "Pre-compiled versions" and select the correct build for your computer (note that I am using the Windows 64-bit version--if you are using Mac or other platform there may be differences).  Download the proper version for your system and run it.

Keep in mind that minor (and sometimes major) changes can occur from one version to another.  The following screen saves are from the Hugin_2011.2.0-beta1-64bit_Windows release.  If you want the "cutting edge" software, try http://sourceforge.net/projects/hugin/files/hugin/.

When you run the setup software the first pop-up box will be:
Select "OK" and you will get:
I have found that checking the "Clean Registry Settings" box avoids some problems, so I always check it also.
You can decide if  you want shortcuts and documentation added.  Select "Next" and you will see:
Select "Next" and get:
Read the license (ha!) and select "I Agree":
Unless you know what you are doing, select "Install":
After a few seconds you should get:
Selecting "Next" yields:
Congratulations, you are ready to run Hugin!

Part 2.  Downloading test photos
If you wish to use the six shots shown earlier in this post you can get them in several ways.  

1) If you have a Flickr account search for images using the keyword "huggintest" (you probably have to create a free account to download the images).  They should be in "xraycrystallographers" photos.   

2) Another way to get the images is to download a zipped file that I have placed on the Slashtmp system at Indiana University.  Simply click on the following url and then enter the password "hugintest" when asked.  There are several freware programs available for unzipping the downloaded file.

Part 3. Creating the panorama
When you start Hugin you should get the startup user interface screen below.  Notice that a pop-up window with "Did you know" hints will appear over the window.  I leave this option on since there are many "secrets" of Hugin that I do not yet know.

After selecting "Close" in the hint window you can use the "File" tab to locate and open the files you want to stitch.  I prefer to open a second window with the images visible as thumbnails so that I can see which ones I want to input.  After selecting all of the desired images I simply "drag" them into the Hugin window:
After dragging the images into the user interface, you should see the following:
Notice under the "Load images" box it now states "6 images loaded".   You can click on the "Images" tab to see the names and sizes of the loaded images.  Before proceeding, I recommend that you click on each of other tabs under the toolbar to see what is available to the user (but don't worry about what these options do  at this stage).

You are now ready to create your panorama.  Simply click on "2. Align..."

A pop-up window will appear with a running commentary of the various processes that take place:


In a few minutes (or seconds or hours depending on the number of images and complexity) you will see a second popup box "Fast Panorama preview" appear. 
Expand this window either by selecting the full screen icon in the upper right or click and drag one of the corners to increase the size of the window.  You should get a screen similar to the following:
When I got to this point the image looked pretty good.  I wanted to play with some of the adjustments so to insure that I did not mess things up I selected "File" and "Save" to save the work I have already done.  A window will appear asking for the name of the ".pto" file to save.  This file will save everything that has been done up to this point.  If something goes wrong, I can simply restart Hugin and use "File" "Open" to get back to this stage.

While everything is working so far it might be worth looking at what one can do in the Fast Panorama preview screen.  One of the neater functions is "Layout".  If you select "Layout" you get the following:
Not only does this show which images are connected by "control points", it allows you to pick a pair of images to be examined in the "Control Point" tab by clicking on the line that joins the two images in question. For our example, let us go ahead and complete the panorama as it now stands.  Simply go back to the Hugin interace and select the "Stitcher" tab:
You will eventually want to learn about the various options available, but for now lets assume that we simply want to generate the final panorama as suggested.  You might want to change the format from Tiff to JPG depending on what you plan on doing with the output, but other than that, simply click on "Stitch". 

You will be asked for the name of the output file.  Enter a name and select "Save".  You will see one or two auxiliary screens open showing the stitching status.

When the panorama is complete the auxiliary windows will disappear and you can view your final result.


Part 4. Creating the panorama by steps
Hugin will generate excellent results for most "normal" situations, but occasionally something will go wrong.  For this reason you should learn to go through the various steps one at a time to see what their functions are.  After loading the six images, go to the "Images" tab and click on the "Create control points" box.  This will locate the control points that can be used to stitch the various photos.  You also have the option of using the "Control Points" tab to individually select the control points to be used, or to delete those that you don't want to use.  

After locating control points the "Optimizer" tab is used to overlay the images and the "Exposure" tab adjusts each image for proper exposure.  I suggest you simply play around with the various controls to see what they do.  If you save your work as a .pto file, you can always recover from a mistake.

Part 4. Understanding Hugin and its capabilities
There are some excellent tutorials available that explain in great detail the many different things you can do with the Hugin interface.You should take the time to read them so that you know what is available.  Don't be discouraged if things don't work as expected each time.  Hugin is a complex system constantly undergoing changes!

The main thing is ENJOY!

Saturday, January 8, 2011

It's fun to fool Mother Nature

One of the problems with modern computers and digital photography is that you can't trust any image!  The following is a photo that, on first inspection, appears to be a real snowflake  with five "spokes"!


Unfortunately, nature doesn't do this sort of thing!  Snowflakes are crystals of hexagonal ice, and are always of hexagonal symmetry.  You can read all about snowflakes by going to Kenneth Libbrecht's excellent site, SnowCrystals.com.

How did I do this?  It was actually quite fun, and the technique can probably be used to manipulate other images that have some sort of axial symmetry.  The following gives the step-by-step operations that were used to create the five-fold symmetry using PhotoShop CS5.

The original photograph was taken using my photomicrography setup for snowflakes*.   While one could spend quite a bit of time cleaning up this image, I purposely left it in a rather crude state so that it looked "real".
The next step is to accurately position the image in the center of a square frame.  There are probably many ways to accomplish this, but I first used the "Image/Canvas Size" instruction to make the image square.  I then used the Line Tool to create an "X" as shown in the image.
I then used the "Move Tool" (v) and moved the image until the snowflake was precisely centered.  It is wise to enlarge the image to 200% or higher to make the centering as accurate as possible.
The next step is to use the "Ruler Tool", followed by "Straighten" ( or "Image/Rotate/Arbitrary" in as in CS4) to insure that one of the spokes is vertical.
The next operation is to  use the "Filter/Distort/Polar Coordinates" tool, selecting the "Polar to Rectangular" option.  The resulting image will appear somewhat like the image shown.  You will find that the is terribly sensitive to where the center of the image is in the canvas.
The next step is to carefully remove one of the spokes by using the crop tool, and then again adjust the Canvas Size to make the image perfectly square again.
The above image is then converted back to a snowflake by using the "Rectangular to Polar" option in the "Filter/Distort/Polar Coordinates" tool.  (There is a bug in CS5 that tends to screw up the Polar Coordinate conversion--if it happens to you simply save the image above and restart CS5.)
You get your final image by cropping and cleaning up any slight imperfections such as the vertical seam seen above.







Once you have mastered the technique, you can create snowflakes with as many spokes as you wish!  Note that you can also make more perfect snowflakes by simply creating a line of "spokes" in a square frame and then converting to the snowflake using the Polar Distortion filter.  How about an 11 pointed snowflake?

Or a seven legged starfish?

___________________________________________________
*You can take a look at the microscope setup I use for photographing snowflakes at Xraycrystallographer.blogspot.

Friday, December 24, 2010

A quick look at HDR

Your eyes can easily adjust to accommodate the lighting conditions of your environment.  If you are in a room with brightly lit areas and deep shadows, the pupils of your eyes will increase or decrease in size to adjust the amount of light so that you can see both extremes in fair detail.  When you photograph a scene such as this you set the aperture (and shutter speed) of the camera to insure the proper exposure for the amount of light present.  If the "dynamic range" is too wide, there may be some areas that are either too dark or too light to see any detail.   The following photographs were taken in my garage (you can click on any of the images to go to full size). Photo 3) was taken with automatic exposure settings, and you can see that there are areas in the photo that are completely overexposed (the garage windows and the light on the clay pot), and areas where the shadows are so dark that detail is lost.  The other images were taken by varying the exposure to allow more or less light to be used.


 1)  Overexposed by 3.3 stops
 2) Overexposed by 1.7 stops
 3) "Proper" exposure
 4) Underexposed by 1.7 stops
5) Underexposed by 3.4 stops







Notice that in the 1) you can see details in the back corner where there is little light, but nearly everything else is "washed out".  In 5) very little detail inside the garage is visible, but you can actually see some details outside the garage through the windows.

HDR techniques allow us to combine two or more of these images so that the overall dynamic range is compressed.  The following two images were created from the above images using HDR software:

 PhotoShop CS5.  (easy, simple, $$$$$)
Hugin.  (confusing, free)







PhotoShop allows you to do some initial adjustments during the HDR creation.  The image using only the defaults was a bit dull and a underexposed using the defaults, so I applied a few adjustments to get it to match the Hugin HDR.  If you enlarge the two HDR images you can see a few differences--for example there is a bit of ghosting in the upper left corner of the Hugin image, but in general they both have a significantly larger dynamic range than the "proper exposure" in 3).

References:
1)  Wiki article on HDR (in depth, but quite good).  http://en.wikipedia.org/wiki/High_dynamic_range_imaging
2)  Creating HDR images with PhotoShop CS5
3)  Creating HDR images with Hugin