Gradation Curves Plugin for VirtualDub
(Version 1.21)

by Alexander Nagiller

[Place this text file in the VirtualDub plugin directory to make it available via the Help button on the filter configuration dialog box. The computer must have an HTML browser, such as Internet Explorer, Netscape or Opera, available in its search path.]

Introduction

This Filter can be used to edit the gradation curves similar to the curves function of painting programs.

This filter is relatively fast although some speed improvement could yet be made (For example: assembler routine for Y calculation...). Finally with Version 1.20 mouse support has been integrated.

What the filter can do / what the filter can be used for: If dark areas of a video are too dark, the filter can be used to brighten them up, without changing light and mid tones. The filter can invert the color space like the internal invert filter and can apply coring also, like the coring filter plugin that exists for VirtualDub. If the tone of a video is, for example too blue, the filter can be used to compensate this. The overall brightness can be changed also. Perhaps the filter can also be used for some scientific use, if there is a need to mask a certain color. And the good thing is, that it can all be done at the same time with one filter instance only.

The x axis of the curve represents the input color value, the y axis represents the output color value. Initially the filter will show a 45° left down to right up curve. This signifies that the output color will be the same as the input color for all color values. Raising the output value, results in a lightning up of the selected input color value. Although it's a bit time consuming to edit the curve with the current user interface, the edited curves are also saved and restored within the processing settings. Once edited, they can be used later on again this way. The filter always stores the settings of all four gradation curves, even if you only use the RGB curve. This way the settings of the R/G/B curves are not lost if, for example temporarily RGB only mode is used and the processing settings are saved at that time.


Gradation Curves Options

Channel: Selects the color channel. RGB shows the curve for the channel that edits all the colors at the same time while Red / Green / Blue shows the curve for each color channel.

The Filter Window: By pressing left mouse button and drawing over the filter window, the curve can be edited. Editing the curve with preview open and some (slow) filters active in the filter chain is not recommended because responsiveness is lost. Either edit the curve with preview closed in such a case or edit the curve with preview active only with this filter active.

Processing mode: "RGB only" will only process the image by the common RGB channel. Any edited color channel will be ignored. "RGB + R/G/B" processes the individual color settings first and then applies the RGB settings. These two modes behave similar to the curves function of painting programs. The weighted modes are just like the first two modes differing only in way RGB is processed. First a Y (gray) value of each pixel is calculated. Then the output value of the RGB curve of this Y (RGB input) value is taken and applied to all three colors of the pixel the same way. An example to demonstrate the difference of the two modes: Let's assume that the output setting for the input value of 30 in the RGB curve is 50. In the mode "RGB only" all pixels that have got a R or G or B value of 30 will be changed to 50, while the other colors of the pixel stay the same (if they are not 30 as well). A pixel with the color R30 G10 B15 will be changed to R50 G10 B15 (if the values for 10 and 15 are unchanged in the curve). While in the weighted mode a pixel that has got a Y value of 30 ex. R10 G38 B50 will be changed to R30 G58 B70. 50-30 = 20 and 20 is summed up to the individual R G B values. The mode "no processing" applies no change and can be used to spot the difference between the activated filter and no processing in the preview window.

Reset: Changes back the currently selected curve to the initial settings, where no processing is applied at all.

Invert: Inverts the currently selected curve. Inverting a curve with initial settings, results in a inverted color space.

Import: Imports external gradation curves. In the dialog box the file containing the curves can be selected and imported. The standard file type is .amp which is used by Adobe Photoshop. But in general any file containing a curve that is structured like .amp files can be imported into the filter. If the import function detects one curve in the file, the data is loaded into the RGB curve. If there are three curves in the import file, they get loaded into the R / G / B curves. With for or more curves within the import file, the first curve gets loaded into the RGB curve then followed by R / G / B. If the file contains more than four curves all curves above the fourth are ignored. Map Files (.amp) can be saved using the curves function of Adobe Photoshop by selecting pen mode. If the spline mode is active, Adobe Photoshop stores another file type that can't be imported into the filter.

Export: Exports a file with the structure of a Map File. The export function always stores all four gradation curves plus one fifth dummy curve. The exported file can be loaded within the curves function of Adobe Photoshop. The file structure is very similar to the way the filter data gets stored in the processing files of VirtualDub. The data in the processing file is stored with hex values FF=255 straight forward. Input value 0 of the RGB curve is in first position, were as only the output value is stored. So it goes from the first output value to the last (255) and then followed by the data of the R / G / B curves. If you look at a Map File with a hex editor you will see the same thing as in the .vcf processing file of VirtualDub.


Copyright © 2005, Alexander Nagiller, All Rights Reserved.