This brief description of ShiftN refers to version 5.0

Translated to English by Hal Hagan and Keith Morris



==== ShiftN functionality =====

Converging lines in photographs, particularly of buildings, can often spoil the desired effect: vertical edges appear slanted, although we perceive buildings as having vertical and horizontal lines. Converging lines occur when the image plane (film or sensor) is tilted relative to the subject. They can be avoided optically with a shift lens or with a medium or large format view camera with movements. With a shift lens, the lens is shifted perpendicular to its optical axis, so that the image plane can remain parallel to the subject. Shift lenses are mechanically and optically more complex than standard lenses, which is why they are comparatively expensive, and most cameras - compact cameras and smartphones in particular - do not allow lens changes at all. Digital photography, and the scanning of existing photos, opens up new possibilities for correcting the picture afterwards. This is where ShiftN comes in.

ShiftN corrects converging lines, and most of the work is done automatically by the program. In most cases, the command "Automatic correction" is sufficient to produce a satisfying result. Both converging lines and a rotation of the camera are corrected automatically.

ShiftN first searches the image for straight lines and edges and considers only those that are sufficiently vertical to be likely architectural elements. Based on these line segments, an optimization process determines the perspective transformation that makes the lines as parallel to each other as possible (shift) and aligns them with the edges of the image (rotation).


=========== Options ===========

Various parameters that control how ShiftN works can be set with the menu "Options | Parameter". You can change them safely: the "Reset" button in this dialog restores all default values at any time.

The first parameter (minimum line length) specifies how long a line must be at least to be used for calculating the correction. If the value is too small, many of the lines found may come not from buildings but from trees, clouds and the like, which can make the correction poor or inaccurate. If the value is too large, the program may not find enough suitable lines on which to base the correction. With the setting "0", the program determines a suitable value itself.

The parameter "Minimum line contrast" specifies the minimum contrast a line must have against its background to be used. As with the line length, lower values give more lines, but also more unsuitable ones, which can lead to poorer results.

The parameter "Maximum tangential deviation" is the largest angle (in degrees) by which a line may deviate from the vertical and still be treated by the program as a vertical line. A setting of 45°, for example, would even accept lines that run diagonally at this angle. Values from 5 to 45 are possible.

Architectural photos often look more natural if the converging lines are not corrected completely (100%) but only partly, for example by 80%: the convergence is then reduced, but not eliminated. This is a matter of taste. The degree of the correction is set as a percentage in the field "Amount of correction [%]" (0 to 200).

By default, ShiftN corrects the perspective as if a shift lens with the same focal length had been used. Particularly with longer focal lengths, this can make the image look unnaturally compressed in the horizontal direction. The parameter for the horizontal resolution specifies whether the correction follows the focal length (value 0.0) or uses a neutral value that does not depend on the focal length (1.0). The value 0.5, for example, is a compromise. Values greater than 1 even stretch the image horizontally, while values below 0 make it narrower.

Besides the effects of the camera position (shift, rotation), ShiftN can also reduce radial distortion caused by the camera optics, which often occurs with wide-angle lenses. To correct it, enter a value between -1 (correction of pincushion distortion) and +1 (correction of barrel distortion) that suits your lens best. Note that the distortion of zoom lenses can vary considerably with the focal length used.

The perspective correction depends on the focal length, so it can be entered here, in millimeters as the 35mm equivalent (8 to 200 mm). The focal length affects the result through a compression of the image perpendicular to the shift direction. For JPEG images, the program tries to read the focal length from the EXIF data. If this is not possible and the focal length used is not known exactly, it can be estimated. Since converging lines usually occur with wide-angle photos, the default is a 35mm-equivalent focal length of 28 mm.

ShiftN calculates the perspective correction much faster if it uses a copy of the image with reduced resolution. The resolution parameter specifies the approximate size of this copy in pixels (the mean of width and height; default 1200, possible values 100 to 16000). It does not change the resolution of the saved result, but it can affect the quality of the correction: small values make the line detection less accurate, very large values need much time and memory.

If you do not want ShiftN to correct the rotation of the camera automatically, uncheck the box "Try to correct rotations automatically".

Many digital cameras store in the EXIF data how the camera was held when the photo was taken (orientation tag). If "Rely on EXIF orientation tag" is checked (the default), ShiftN rotates JPEG images accordingly when loading them, so that portrait photos are displayed and corrected upright. The corrected image is saved upright, and its orientation tag is set to "normal". Occasionally this EXIF information is wrong, for example if another program has rotated the image without updating the tag. If a photo appears rotated incorrectly in ShiftN, uncheck this option.

The most frequently asked question: Why are photos taken in portrait format loaded in landscape format? Solution: check "Rely on EXIF orientation tag" in "Options | Parameter" (checked by default since ShiftN 5.0).



========= File formats ========

ShiftN opens JPEG, TIFF, PNG and BMP files. To save the corrected photo, it offers three file formats (JPEG, BMP and TIFF), which are selected in "Options | Type of output"; several formats can be selected at the same time. The JPEG quality is also set there.

When a JPEG file is saved, ShiftN keeps the EXIF data of an original JPEG (with an updated preview image and image size) and an embedded color profile. Images with 16 bits per color channel (TIFF or PNG) are saved with 16 bits per channel if the TIFF format is selected.

The correction produces empty areas at the edges of the image (usually at the bottom left and right), because the corrected image is no longer a rectangle. They are filled with white or with the background color selected in "Options | Type of output". If "Trim pictures automatically" is checked, the program cuts these areas off and loses as little of the image as possible. However, this can change the aspect ratio and cut off important details. In such cases it is better not to use automatic trimming and to select the desired area in the corrected image with the mouse instead: drag with the left mouse button for a free selection, or with the right mouse button to keep the original aspect ratio. Saving and copying then use only the selected area.

To correct perspective and distortion, the image has to be recalculated (interpolated). Two methods are available: bilinear and bicubic interpolation. Bicubic interpolation takes longer, but gives better image quality. Interpolation acts like a low-pass filter, so subsequent sharpening is needed to restore the detail contrast of the original. ShiftN uses unsharp masking for this, as many other image editing programs do. It is controlled by a sharpening parameter, the factor by which the detail contrast is increased: with the value "1" no sharpening takes place; the value "1.3" approximately restores the details of the original when bicubic interpolation is used.

Save the corrected image with the menu "File | Save results". The result is saved in the folder of the input file, and by default "_ShiftN" is added to the file name. This suffix can be changed in "Options | Type of output"; if the field is empty, the original file is overwritten. With "File | Save as..." you can choose the folder and the file name freely; ShiftN sets the file extension according to the output format. For batch processing, a separate output folder is selected (see below). If "Use EXIF date/time" is checked, a saved JPEG file gets the recording time from the EXIF data as its file date.

Instead of saving a file, you can copy the result (or the area selected with the mouse) to the clipboard with "Edit | Copy" or Ctrl+C. Conversely, "Edit | Paste" or Ctrl+V loads an image from the clipboard; as such an image has no file name, "Save results" then asks for one.

An existing file is only replaced when the new file has been written completely. If a file cannot be saved (for example without write permission, or because it is open in another program), ShiftN shows a message.


========= ShiftN use ==========

As mentioned above, ShiftN is very easy to use. Open an image with "File | Open" or drag it onto the ShiftN window, and click "Automatic correction" - in most cases nothing else is needed. ShiftN corrects the converging lines and, if "Try to correct rotations automatically" is checked, the rotation of the camera. The "Page Up" and "Page Down" keys switch between the original and the corrected image for comparison.

Depending on the image content, lines that obviously do not belong to the relevant object are sometimes used for the calculation and can falsify the result. In this case, you can switch off individual detected lines in the line display (right-hand image) with the left mouse button - they are then drawn in red - or switch off all lines with the "Del" key. Lines that have been switched off can be switched on again with the right mouse button. Then recalculate the perspective correction with the remaining lines by clicking "Re-optimize".

If you are still not satisfied with the result, you can adjust the correction manually: "Adjust correction" lets you change the values found automatically (shift, rotation) and the values set in the parameters (distortion, horizontal shortening) with sliders or by entering numbers. "Reset" restores the values of the automatic correction.

To correct a larger number of images automatically, use "File | Batch processing". First select the files to be processed, then the folder for the results. The images are processed in the order of their file names with the current settings; the results get the suffix set in "Options | Type of output" (if several files would get the same name, a number is added).

If "Batch processing" is checked in "Options | Parameter", ShiftN does not search for lines in every image, but applies the correction of the image currently loaded (shift and rotation) to all images - useful for a series of photos taken from the same position.

At the end, ShiftN lists the files that could not be loaded, the images in which no suitable lines were found (no result), and damaged or incomplete files.


=== Command Line Parameters ===

Other programs can call ShiftN to correct an image, for example as an external tool of an image viewer:

ShiftN.exe input [output [mode [focal length]]]

"ShiftN.exe photo.jpg" opens the file in the ShiftN window.

"ShiftN.exe photo.jpg result.jpg" corrects the image automatically, without showing a window, and saves the result as result.jpg in the formats selected in "Options | Type of output".

"ShiftN.exe photo.jpg result M1" opens the ShiftN window with the image for a manual correction (M); "Save and exit" saves the result as JPEG (1) under "result.jpg" and closes ShiftN.

"ShiftN.exe photo.tif result A5 24" corrects the image automatically (A), assuming a focal length of 24 mm, and saves it as JPEG and TIFF (1+4): result.jpg and result.tif.

"ShiftN.exe Clipboard Clipboard A" takes the image from the clipboard, corrects it automatically and copies the result back to the clipboard.

Input: an image file (JPEG, TIFF, PNG, BMP) or the word Clipboard. Output: a file name or the word Clipboard. ShiftN sets the extension of each output format (.jpg, .bmp, .tif); a name ending in .jpeg or .tiff is used as given.

Mode: A (automatic, the default) or M (manual). In automatic mode ShiftN shows no window, no progress bar and no messages. An optional digit directly after A or M selects the output formats: 1 = JPEG, 2 = BMP, 4 = TIFF. The values can be added: 3 saves a JPEG and a BMP file, 7 all three formats. Without a digit, the formats selected in "Options | Type of output" are used.

Focal length: optional, in millimeters as the 35mm equivalent (8 to 200); it replaces the value from the EXIF data. All other settings (resolution parameter, JPEG quality, sharpening ...) are those saved in ShiftN.

In automatic mode, the exit code of ShiftN.exe reports the result: 0 = the result was saved, 1 = the input could not be loaded, 2 = there is no result or it could not be saved, 3 = ShiftN could not start.

Translated to English by Hal Hagan and Keith Morris

 

back