2013年10月2日 星期三


AdaptiveStretch自適性拉伸




Adaptive nonlinear intensity transformation based on existing pixel-to-pixel relations. [more]基於現存像素對像素關係性的自適性非線性拉伸強度轉化。

Categories種類: IntensityTransformations強度轉化

Keywords關鍵字: adaptive nonlinear intensity transformation, contrast manipulation自適性 非線性 強度 轉化,對比 操作

Contents內容



Description說明

AdaptiveStretch is a general contrast and brightness manipulation tool in PixInsight. It implements a nonlinear intensity transformation computed from existing pairwise pixel relations in the target image. The process is mainly controlled through a single noise threshold parameter. Basically, brightness differences below the noise threshold are regarded as due to the noise and other spurious variations, and are thus attenuated or not enhanced. Brightness differences above the noise threshold are interpreted as significant changes in the image, so the process tends to enhance them.自適性拉伸是在PixInsight中的一個對比與亮度的操作工具。它實現了來自於目標影像中的現存成雙關係所計算非線性強度轉化。這個處理主要是透過一個單一雜訊門檻參數來控制。基本上,藉由低於雜訊門檻的亮度差異,會被認為是因著雜訊與其它偽造的(寄生的)差異,且因此而被衰減或是沒有被加強。高於雜訊門檻的亮度差異會被解釋為一個在影像中重要的改變,因此處理傾向於加強它們。
Our implementation is based on the algorithm described by Maria and Costas Petrou. [1] All brightness differences between adjacent pairs of pixels are first computed and classified to form two disjoint sets: positive forces, due to significant variations, and negative forces, or variations due to the noise. Positive forces tend to increase the contrast of the image, while negative forces act in the opposite direction, protecting the image. The process uses these two forces to compute a nonlinear mapping curve, which is then used to transform the image by interpolation.我們的供給供具是基於由Maria 與Costas Petrou所描述的演算法。所有在鄰近的像素對間的差異會首先被計算並分類,以便形成兩個分離組:正力,肇於重要的差異。負力或是差異,肁於雜訊。正力傾向增加影像的對比,而負力則是在反向動作,是保護影像。這個處理使用這兩個力來計算一個非線性映射曲線,之後會被用來藉由內插來轉化影像。
The following list summarizes the main features and advantages of the AdaptiveStretch tool:以下的列表總結了自動拉伸工作的主要功能與優點
  • It is essentially a one-parameter process (a second contrast-limiting parameter is optional).它本質上是一個單一參數處理(第二個對比限制參數是可選的)
  • The computed transformation curve is optimal, in the sense that it maximizes contrast without intensifying spurious data.已計算的轉化曲線是最佳的,在這個意義上,在沒有強化偽造資料下最大化對比
  • It allows to find an optimal curve very easily in a completely objective and unbiased way. The same curve can be very difficult to find using manual adjustments.它允許在一個完全客觀與不偏移的方式,很容易的找到一個最佳曲線。使用手動調整的話,相同的曲線就很難找到最佳曲線。
  • The transformation guarantees that no pixel will be clipped, neither at the shadows nor at the highlights. Initially clipped pixels, or pixels that are either black or white in the original image, will be preserved in the transformed image.這個轉化保證無論是在陰影或是在高光中,沒有像素會被剪裁掉。初始已剪裁掉的像素,或是在原始影像中黑或白的像素,將會被保存在已轉化的影像中。
  • Provides full real-time preview functionality, including real-time generation of curve graphs.提供完全的即時預覽功能,包含即時產生曲線圖形
  • In difficult cases, a region of interest (ROI) can be defined to restrict analysis of pairwise pixel variations to a significant area of the image.在艱難的事例中,一個感興趣的區域(ROI)可以被定義為:對影像有意義區域的成對像素差異之限制分析。
  • The computed mapping curve can be converted into a CurvesTransformation instance automatically.這個已計算的映射曲線可以自動轉換為一個曲線轉化樣品。
  • Can be used to stretch linear raw CCD monochrome and OSC CCD / DSLR color data.可以用來拉伸線性生單色CCD與彩色CCD/DSLR彩色資料。
  • Provides excellent results with both astronomical and daylight raw images.可以提供天文與日間生影像優異的結果。
The two main tools for nonlinear intensity transformations in PixInsight are HistogramTransformation and CurvesTransformation. With AdaptiveStretch we don't intend to replace those fundamental tools, but to provide an alternative way to perform brightness/contrast manipulations, including the initial nonlinear stretching step of raw data. The most interesting feature of AdaptiveStretch is that it works by analyzing the true contents of the image. Other tools require purely manual work, and hence their results depend more on the knowledge and ability of the user to understand the image. Understanding subtle relations between different image structures can be difficult, and in this sense AdaptiveStretch can be seen as a powerful tool for objective analysys.在PixInsight中,兩個主要用來做非線性強度轉化的工具為分市圖轉化與曲線轉化。以著自適性拉伸,我們並不傾向取代這些基礎工具,不過為了提供一個可替換式的方式來執從亮度/對比操作,包含了生資料的初始非線性拉伸步驟。非線性拉伸最有趣的功能,是它藉由分析影像的真實內容。其餘工具需要純粹的手動工作,且因此它們的結果,更多是根據使用者的知識與能力來了解影像。

Parameters參數


Noise threshold雜訊門檻

The AdaptiveStretch process computes a nonlinear curve to enhance existing brightness differences above the noise threshold parameter. Brightness differences smaller than the noise threshold will be diminished or not enhanced in the processed image. Decrease this parameter to apply a more aggressive nonlinear transformation. In general, you should fine tune this parameter along with contrast protection to find an optimal combination.在雜訊門檻參數以上時,自適性拉伸處理計算一個非線性區線,來加強一個現存的亮度差異。亮度差異小於雜訊門檻時,在已處理影像將會減少或是不會被加強。減少這個參數來套用一個更攻擊性的非線性轉化。一般說來,你應該與對比保護一起微調這個參數,以便找到一個最佳的組合。
A comparison of different results obtained by varying the noise threshold parameter of AdaptiveStretch. The original image is a 16-bit raw DSLR image taken with a Canon EOS 450D camera.變化自適性拉伸的雜訊門檻參數所獲得的不同結果之比較。原始影像是一個16位元的生DSLR影像,由Canon 450D相機所拍攝。
(a) Top left左上: De-Bayered linear image.去拜耳化的線性影像
(b) Top right右上: Noise threshold雜訊門檻 = 1×10-2 (c) Bottom left左下: Noise threshold雜訊門檻 = 3×10-3 (d) Bottom right右下: Noise threshold雜訊門檻 = 5×10-4

Contrast protection對比保護

The contrast protection parameter limits the increase of contrast on very bright and dark areas. Increasing this parameter can help control excessive intensification of highlights and darkening of shadows. Irrespective of its value, this parameter can be disabled or enabled; it is disabled by default. This feature allows for quick comparisons between the results with and without contrast protection applied.對比保護參數限制了在十分亮與十分亮區域對比度增加。增加這個參數可以幫助控制高光過度加強與陰影的暗化。與它的值無關,這個參數可以取消或是開啟。它內定是取消。這個功能允許在有著對比保護加強與沒有對比保護加強結果間的快速比較
An example of use of the contrast protection parameter of AdaptiveStretch. As in the preceding example, the original is a 16-bit raw image shot with a Canon EOS 450D camera.使用自適性拉伸對比保護參數的例子。如在之前的例子,原始檔是16位元生影像,由Canon EOS 450D相機所拍攝。
(a) Top left左上: De-Bayered linear image.去拜耳化線性影像
(b) Top right右上: Noise threshold雜訊門檻 = 1×10-3, no contrast protection.沒有對比保護
(c) Bottom left左下: Noise threshold雜訊門檻 = 5×10-3, no contrast protection.沒有對比保護
(d) Bottom right右下: Noise threshold雜訊門檻 = 1×10-4, contrast protection對比保護 = 8×10-2

Maximum curve points最大曲線點

This is the maximum number of points computed to build the transformation curve. The default value is 106 points. For 8-bit and 16-bit integer images, AdaptiveStretch can compute a maximum of 256 and 65536 curve points. Note that in these cases computing more curve points would make no sense because the minimum possible nonzero difference between two pixels is one discrete unit. For 32-bit integer images the theoretical limit is 232 curve points, which is impractical for obvious reasons.這是計算點的最大值,以建立轉化曲線。內定值是 106點。對一個8位元與16位元積分影像而言,自適性拉伸可以計算256與65536值點的最大值。注意在這些情況下,計算更多曲線點將會沒有意義,因為在兩個像數間的差異最小可能的非0差異是一個離散單元。
For 32-bit and 64-bit floating point images a maximum of 107 and 108 curve points can be calculated, respectively. Note that lowering the number of curve points can limit the ability of the algorithm to detect very small brightness changes between adjacent pixels, which are essential to account for variations due to the noise in the image. In practice, however, the default limit of 106 discrete values is more than sufficient for most 32-bit floating point images. Increasing this parameter can improve the result for very rich floating point and 32-bit integer images, usually resulting from deep HDR compositions. Keep in mind that large curves will increase computation times considerably, so they should only be used when actually required. In most cases, the default value of this parameter is quite appropriate.對一個32位元與64位元的浮點影像而言,能夠個別地計算107 and 108曲線點的最大值。注意降低曲線點的數可以限制演算法的能力,以便偵測十分小亮度在鄰近像素間的改變,它在考量因著在影像中雜訊的差異是不可或缺的。然而,實際上,內定限制106離散值,對32位元浮點影像是十分足夠的。增加這個參數可以改善對通常是由深度的高動態範圍合成產生的十分豐富的浮點與32位元積分影像之結果。記住大曲線將會相當地增加計算時間,因此它們應該只在需要時才使用。在大多數的情況中,這個參數的內定值是十分合適的。

Region of interest有興趣的區域

By default, the AdaptiveStretch process analyzes pairwise pixel brightness differences on the whole target image. Normally this is the best option if there are no big differences in brightness, or if some big differences can be safely ignored. A typical example is an indoor daylight scene where we decide that it is OK to burn a window completely. However, there are more difficult cases where these simple assumptions are unacceptable, or where they simply don't work. In these cases a region of interest (ROI) can be defined to restrict the analysis to a rectangular region of the image. The ROI is defined by the X and Y pixel coordinates of its upper left corner, and by its width and height in pixels. The process will ignore a ROI with less than 16×16 pixels, or a ROI that lies completely outside the image.內定值是自適性拉伸處理分析成對像素在整個目標影像上的亮度差異。一般說來,如果沒有在亮度上的大差異的話,這是最佳選項,或是如果一些大差異可以被安全地忽略。一個典型的例子是一個戶內日光場景,在此我們決定完全爆了一個視窗是OK的。然而,有更多困難的情況是何處這些簡單的假定不可接受的,何處是它們實際上無法工作的。在這些情況中,一個感興趣的區域(ROI)可以定義為對一個影像矩形區域的限制分析。這些ROI是藉由它的左上角的X與Y像素座標,與它以像素計的寬與高。這個處理將會忽略有著小於16X16像素的ROI,或是完全置於影像外的ROI。
An example of the use of regions of interest (ROI) to control the AdaptiveStretch process. As a whole, this image as quite flat, or in other words, it is dominated by an overwhelmingly large amount of pixels with intermediate values. This is more evident on the result of a histogram transformation shown in section (b). Using the whole image to analyze pairwise pixel differences yields a too contrasted result (c), where the dimmest areas are too dark and the brightest regions are too flat. This happens because the AdaptiveStretch algorithm computes a transformation to optimize contrast for a dominant subset of the analyzed pixels.使用ROI來控制自適性拉伸處理的範例。就處體而言,這個影像相當平坦,換句話說,它是由一個壓倒性大量有著有著中間值的像素所支配。這在一個顯示在(b)部分中分布圖轉化結果是更明顯的。使用整個影像來分析成對像素的差異,產生一個過度對比的結果(c),此處,最暗的區域太暗且最亮的區域太平坦。這個會發生是因為自適性拉伸演算法對已分析像素的主導子集合計算一個轉化來最佳化對比。
By restricting the analysys to a smaller area, where bright and dark structures are equally well sampled, and intermediate pixel values are no longer dominant, the result (d) allows us to show much better the entire range of structures in the image. This is a nice example of complex image dynamics. Note however that the result achieved in section (c) can be improved using HDR compression techniques in PixInsight, for example with the HDRMultiscaleTransform tool, which opens a completely different path for processing. Image courtesy of Ivette Rodríguez and Oriol Lehmkuhl.藉由對較小區域的限制分析,在此亮與暗結構會相等地良好被取樣,且中間的像素值就不再佔優勢,結果(d)允許我們顯示在影像中較優的整個結構範圍。這是一個複雜影像動態的良好範例。然而,注意在(c)部分中所達成的結果可以使用在PixInsight中的動態範圍壓縮技巧(如高動態範圍多尺寸轉化工具來改善,它對處理打開一個完全不同的路徑。影像承蒙Ivette Rodríguez 與 Oriol Lehmkuhl的特許。
(a) Top left左上: The linear image with an automatic screen stretch (STF) applied (note that the automatic STF transformation clips pixels at the shadows).套用STF的線性影像(注意自動STF轉化裁掉陰影像中的像素)
(b) Top right右上: Result achieved with the HistogramTransformation tool by clipping unused histogram sections at both ends and applying a midtones balance value of 0.005.用分布圖轉化工具達成的結果,它藉由裁剪分布圖部分兩端未使用的部分,並套用一個0.005的中間調平衡值
(c) Bottom left左下: Result of AdaptiveStretch, noise threshold = 10-4, curve computed for the whole image (no region of interest).自適性拉伸的結果,雜訊門檻=10-4,對整個影像做曲線計算(無ROI)
(d) Bottom right右下: Result of AdaptiveStretch, noise threshold = 1.2×10-4, region of interest set to the green rectangle shown on (a).自適性拉伸的結果,雜訊門檻=1.2×10-4,ROI設為顯示在(a)上的綠色矩形。
Another example of AdaptiveStretch with a region of interest (ROI). In this example, a ROI covering the main subject has been used to prevent the excessive contrast increase in the processed image. The relative lack of color saturation can be easily compensated with a color saturation curve.另一個有用ROI的自適性拉伸範例。在這個範例子,一個ROI涵蓋主物體,用來防止在已處理影像中的過度對比增加。相對的缺乏的顏色飽和可以很容易的用顏色飽和曲線來補償。
(a) Top left: The linear image. This is a de-Bayered raw DSLR image acquired with a Canon 450D camera.
(b) Top right: Result of AdaptiveStretch with noise threshold = 8.7×10-4 and contrast protection = 0.355, no ROI.
(c) Bottom left: Result of AdaptiveStretch, noise threshold = 6.7×10-4, contrast protection = 0.375, ROI set to the green rectangle shown on (a).
(d) Bottom right: The result of (c) after a color saturation curve applied with CurvesTransformation.

Usage


Exponential Controls

The noise threshold and contrast protection parameters of AdaptiveStretch are extremely sensitive. They can vary in the range from zero to one with eight digits of fractional precision. This extended precision is necessary to process 32-bit floating point and integer images. For 16-bit integer images, usually 4 or 5 decimal digits are required. As a result, the usual edit and slider combined controls that are ubiquitous in the PixInsight platform, are just too rough to control these parameters.
For these parameters we have implemented a specialized control with three subcontrols: an edit field to enter the parameter value with 8 decimal digits; an edit/slider combo to specify the coefficient in scientific notation, with 2 decimal digts in the range from 1 to 9.99; and a spin box to specify the exponent in the 0 to -8 range.
For example, in the figure above, the value of the noise threshold parameter is 0.000275, which is equivalent to 2.75×10-4 in scientific notation. By increasing and decreasing the exponent by one unit, you can quickly change the scale of the parameter by one order of magnitude. By moving the slider, you can fine tune the coefficient. This allows you to control a sensitive parameter very easily with the mouse without needing to write numeric values.

Using AdaptiveStretch in Real-Time Preview Mode

Despite being a rather automatic process, AdaptiveStretch is a highly interactive tool. In fact, you actually cannot apply this tool properly unless you fine tune its two main parameters during a real-time preview session. The reason for this is that this is an adaptive tool: it computes a transformation based on the existing brightness differences between adjacent pairs of pixels in the target image. Of course, you can also adjust AdaptiveStretch parameters using standard previews in PixInsight, which allows you to achieve very accurate results, but the real-time preview is just more convenient and easy to use. Once you have found good parameters with the real-time preview, nothing stops you to refine them using standard previews, if necessary.
Working with the AdaptiveStretch tool in real-time preview mode on a raw CCD image of NGC 1808. Image courtesy of jack Harvey / SSRO.
The RealTimePreview virtual view can be used to inspect the histogram of the transformed image on the HistogramTransformation tool during an AdaptiveStretch real-time session. The histogram and the curve graph provide you with a wealth of information to control the final image.
Curve Graphs
One of the most useful features of AdaptiveStretch is its ability to generate a real-time curve graph. This graph represents the transformation curve being computed as a function of the current process parameters. The graph is drawn on an auxiliary window when the tool is working in real-time preview mode, if the real-time curve graph check box is checked.
The curve graph allows you to fully evaluate and understand the transformation being applied, while you can see the result on the real-time preview window, and even its histogram on the HistogramTransformation tool with the RealTimePreview virtual view selected (an example of this is shown on the figure above). Two buttons on the AdaptiveStretch Curve Graph window allow you to render the graph as a new image window (as an 8-bit RGB color image) and to convert the current AdaptiveStretch curve into a CurvesTransformation instance. This is useful to apply the same transformation curve to a set of images. Since the AdaptiveStretch process depends on the contents of the image being processed, each running instance applies a different transformation to each particular image; however, CurvesTransformation is not an adaptive process and hence does not have this limitation.
An AdaptiveStretch curve and its equivalent CurvesTransformation instance.

References

[1] Maria Petrou and Costas Petrou, Image Processing: The Fundamentals, Second Edition, John Wiley and Sons Ltd., 2010, pp. 377–382.







沒有留言:

張貼留言