Bezier Circle

Approximate a circle with cubic Bezier curves: here’s a simple method, written in Processing. The key to approximating the circle is a constant, kappa, that will help us calculate the distance from a Bezier anchor point on the circle to its associated control point, off the circle. Kappa is the distance between the anchor point and the control point divided by the circle radius, when the circle is divided into 4 sectors of 90 degrees. See these notes by G. Adam Stanislav for the math.

Circle approximated by five Bezier curves. Click to view applet.

Notes: Kappa is scaled by the number of sectors into which the circle is divided (k = 4 * kappa / sectors). Four sectors is the minimum required to get a good approximation. With a little bit of work it should be possible to create a circle with unequal sectors, scaling kappa by the portion of the circle occupied by each sector. From there, one could make various sorts of blobs by scaling the the control points and anchor points around the center of the original circle.

Lab Enhancements

Using Photoshop’s Lab color mode, you can perform a number of simple image enhancements. For some of these enhancements there are similar RGB operations; however, the results are subtly (and sometimes not-so-subtly) different. The international standard L*a*b* color space from which the Lab mode in Photoshop was derived was constructed to capture the range of human vision. It was based on statistical evaluations of the range of color vision (the “a” and “b” channels)  and of just-perceptible differences in brightness (the Lightness channel).

Several techniques are illustrated by Photoshop actions that you can download. Explanations and a few tips on how to perform the actions manually follow.

Continue reading ‘Lab Enhancements’

Lab Lightness

Lab color mode can be used for brightness, contrast, and color enhancements in somewhat different ways than RGB mode. Where RGB mode provides a composite channel (RGB) that is composed of red, green and blue channels, Lab mode provides a composite channel (Lab) that is a composite of Lightness, “a” and “b.” The a and b channels encode the color information, while the Lightness channel, as it name suggests, encodes the grayscale values.

Image of a man, showing Lab and lightness channels

Sample image with Lab and lightness channels

Continue reading ‘Lab Lightness’

Fresnel Ring Moires

This Processing applet shows how overlapping Fresnel rings create moiré patterns that are either straight lines or Fresnel rings. The animation moves the two Fresnel rings together and apart at a constant rate, but the moiré patterns accelerate and decelerate. Animation works best when your browser isn’t doing a lot of other tasks that interrupt the applet–download it for best results.

Click in the applet and type “m” to use the mouse to drag the rings left and right. Type “a” to animate again. Source Code: moire. Made with Processing.

The Fresnel rings are drawn with circles using different stroke widths and no fill. The stroke widths derived by subtracting the diameters of a series of circles proportional to successive square roots of a sequence of integers 1..N.

  for (int i = 0; i < rings; i++) {
    diameters[i] = (float) Math.sqrt(i + 1) * max_diameter;

Fresnel lenses are composed of prisms arrayed in Fresnel rings. In the 50s, plastic lens that you could slap onto your teevee to magnify the picture were popular. Large ones are used in solar cookers. The advantage over regular lenses is that Fresnels can be much lighter. They can also be built of modules that fit into a frame--this made them very efficient for focusing lighthouse lights, as they could be transported in sections and assembled on site.

Incidentally, putting a Java applet (from Processing) into a WordPress post was not simple. Following advice in the Processing forum, I resorted to the (deprecated) <applet> tag instead of using the markup generated by Processing. If anyone knows how to use that more current markup (or something similar), please post a comment. I had to do my final edits in the HTML editor and insert the <applet> tag with no linebreaks. Do not go back the visual editor if you do this--it will clobber the applet markup (you could probably fine tune MCEdit to get around this).

You can see this applet its own page, generated by Processing, here.

Night Noise

You can reduce the noise in low light photography by taking multiple images and merging them to extract the statistical mean or median value. These statistical operations are available in Photoshop’s Layers > Smart Objects > Stack Mode menu. Here is a clear example of the effects of the mean and median operations on a stack of four similar images.

three images showing noise reduction by mean and median operations

Original, mean, and median images compared

The leftmost image is one of four similar images that were stacked into a smart object. In the middle image, the mean value (average) of the four images is used as the value of at each pixel position. In the right image, the median value (midpoint of the range of values) is used. You can find the full median image here.

The noise reduction is pretty dramatic (you’ll have to click on the image and view it full size to see what I mean). I find the mean image somewhat smoother, visually, than the median image, but the median image has some advantages over the mean.

A man in a yellow rainjacket walked across the view while I was shooting. You can see four images of him in the mean image: logically, one fourth of the pixels  in the stack at those points belonged to the moving man, so he has a ghostly presence. In the median image, he has practically disappeared: the influence of details or noise that appear in only one of the images is much less marked than in the mean image. The median operation is particularly useful for removing momentary details from a statistical composite.

Of course, the reason the original images were so noisy is that I was shooting hand-held at a high ISO (1600). If I had used a tripod and lower ISO with time exposure, I would not have had to resort to statistical operations for noise reduction. Knowing that the image would be noisy, I shot multiple images and used Photoshop’s File > Automate > Photomerge… command to position the images in layers. Details of how to do this can be found in an earlier post, Statistical Blending.

Layered Contrast

Here is a Photoshop technique for contrast that uses layers, one for the lights and one for the darks. Contrast can be adjusted with many commands in Photoshop: Brightness/Contrast, Levels, Curves, Exposure, to name a few. Layered contrast provides certain kinds of control you can’t achieve with the other commands. I’ll describe it step by step for you, by way of explanation, and also provide a downloadable action.

Continue reading ‘Layered Contrast’

High Pass Enhancements

Photoshop’s high pass filter can be used with layers to achieve some very useful image enhancements. This post discusses how to increase or decrease contrast along object edges and provides a few downloadable PS Actions. High pass edge contrast enhancement is a standard trick for adding “punch” to images: you probably see it all the time without even realizing it. Edge contrast reduction is a logical consequence of edge enhancement. It could be used as a “softening” filter, but probably qualifies as an “effect,” since it runs counter to expectations for good images. In other words, it’s just waiting for someone to exploit its potential.

Continue reading ‘High Pass Enhancements’

Statistical Blending

You can use statistical blending to render high dynamic range images, to reduce noise, or to create multiple exposure effects in Photoshop (CS4 extended edition). All these techniques require that you have multiple images to start with. For HDR images, you need different exposures of the same subject from a stationary viewpoint. The same is true for noise reduction, only the exposures should be identical. Multiple exposure effects can use any number of different images, all of the same dimensions. In each case, you start by stacking all the images into layers, selecting all layers, and converting them into a smart object. Then you use the Layer > Smart Objects > Stack Mode functions Mean or Median to create a statistical combination of all the images, which you can rasterize. Details after the break.

Continue reading ‘Statistical Blending’

Worthy of 16-bit Printing

Is there really any difference between printing with 8-bits per channel and printing with 16-bits per channel? I’m not sure yet, but I’ve been dealing with a photo that could reveal the difference. It has some very fine, continuous gradations–exactly the sort of thing that Epson says is worthy of 16-bit printing on the 9900.

Evening light

Evening light (Alma de la Serra, 2009)

I’ve been printing this on Hahnemühle Photo Rag (HPR), an exquisitely unforgiving paper. I reveals every glitch–which is to say, it’s a fantastic paper, capable of recording the finest nuances. I’ve been printing this 16-bit/channel image in 16-bit/channel resolution, and have been very gratified with the results.

Dust has been the only problem. Ink on HPR will not bleed into the gaps left by tiny particles, nor does it have a texture that will hide specks. This particular image really shows such flaws. I throw out about a third of the prints, looking for perfection. Nothing else will do. I haven’t had this problem with other papers–but maybe I’ve just been lucky, or there’s more static charge on HPR. In going digital, photography has not left dust behind.

Incidentally, this is a high dynamic range image, a composite of 5 images. I used qtpfsgui to composite and tonemap the image and finished the processing in Photoshop CS4. Qtpfsgui/ Luminance HDR is an open source application for HDR workflow. It doesn’t have the bells and whistles of Photomatix or Photoshop, but it gets the job done, once you grok the interface.

This print and a few others by Alma de la Serra will be on view at Transistor over the coming weeks.