PFClean: Auto Dirt Fix


In this tutorial you will learn how to use the Auto Dirt Fix effect in PFClean’s Workbench to automatically remove specks of dirt, dust etc from a clip.

Tutorial Footage

To learn this tutorial you will need to download and use the footage below.



01. Importing Clips

In the Media Manager, import the clip provided for this tutorial. Then create a Workbench node and connect it to the Media Bin. Double click the Workbench node to open.

02. Using The Defect Map

Viewing The Alpha Channel Data

The tutorial clip has been scanned with an IR pass and the clip includes a defect map in the alpha channel. Click the A key to toggle between viewing the alpha channel and the RGB data in the Cinema. Scrub to frame 6 and compare the frame’s alpha channel with the RGB. You will notice that the visible piece of dirt corresponds to a black area in the alpha channel.

Setting Up The Defect Map

Click the thumbnail at the top of the Stack Manager to open the Clip Manager to access the clip’s defect map settings. Since defects are marked as dark spots in the defect map, click the black alpha alpha_pfclean button. Click the View button to get see the areas identified as dirt in the defect map highlighted in the Cinema. For greyscale defect maps, like the one in the tutorial clip, you can define which values should be interpreted as dirt with the threshold slider. The default of 0.5 works well for this clip.

03. The Auto Dirt Fix Effect

Click the + button on the right to create an Auto Dirt Effect. As soon as the effect is created, it reads the clip’s defect map and fixes the dirt in the current frame.

04. Adjusting The Fix Paramaters

Go to frame 13 and click the View button to highlight the areas that have been fixed in this frame. Frame 13 contains a particularly large piece of dirt. Use the middle and right mouse button to zoom on that area. Then click View again to inspect the fix.

The parameters in the Fix section define how the Auto Dirt Fix effect fixes the areas that have been identified as dirt. The Type parameter defines whether dirt areas should be fixed spatially, that is by using neighbouring pixels to fill the area, or temporally, using motion compensated information from neighbouring frames. By default, small areas are fixed spatially and larger areas are fixed temporally. The Threshold parameter defines up to which size spatial fixes will be applied. If you de-select the Spa. button, all areas will be fixed temporally. Accordingly, all areas will be fixed spatially, if the Temp. button is de-selected. De-select the Temp. button to see what a spatial fix of this dirt area would look like.

You can find more information about these and all the other parameters in the Auto Dirt Fix manual, which will open in your web browser when you click the help effect button.

05. Adding a Grain Profile to The Fix

Creating a Grain Profile

There is a fair amount of grain in the tutorial clip and especially spatial fixes will stand out as the fixed areas are lacking grain. For these situations it is possible to select a grain profile to automatically apply grain to the fixed areas. Grain profiles can be created in a De-Grain effect. In order to create the grain profile on the untouched original clip, create a new stack by clicking the + button in the stack controls area. Then create a De-Grain effect.

Sample Grain

Use the middle mouse button and right mouse button in the Cinema to zoom out and pan so that the left bodge of the frame is visible. Then click the Sample button and draw a rectangle in the area near the top left edge of the frame. The De-Grain effect analyses the area in the sample rectangle and updates the Size and Intensity values accordingly. For this clip, the Intensity values for red and green should be just over 4.0. Click the Store button in the Presets section to store the grain preset.

Using The Grain Profile

With the grain profile created we no longer need the De-Grain effect so click and confirm the delete_pfclean button in the stacks controls area to delete the whole effect stack and automatically return to stack that contains the Auto Dirt Fix.

In the Auto Dirt Fix effect, zoom and pan back to see the fixed area, then select the Grain1 preset in the Grain/Noise Preset menu. Notice how the grain has been applied to the fix. For a better result, turn Temp. back on as a fix mode. You can compare the fix with the grain noise preset applied or not by switching the selection between Grain/Noise Preset and Grain1 in the menu.

06. Reviewing The Result

Click the full_res_pfclean button to view the clip at full resolution or select any other zoom level of your choice, then click the Playblast play_blast_pfclean button to review the fixes. Once the clip has been cached, you can use the A/B button for a before/after comparison in the Cinema. Drag the red box at the centre to move the dividing line, or drag it anywhere to rotate. Turn off the A/B split and click the Playblast button again to return to the effect.

07. Getting Fix Statistics

Whilst fixing the clip, PFClean has collected statistics about the fixes. These are illustrated in the results graph. Click the Pix, %, Fix or Time button to view the number of fixed pixels, percentage of fixed pixels, number of fix areas or the processing time for each frame respectively.

Click the report_pfclean button to open the report panel. Then click the topmost project entry to display the project report. The Auto Dirt Fix effect’s fix statics is included in this report, which can be exported to various formats when exporting the clip. Click report_pfclean the button again to return to the effect.

08. Using Automatic Dirt Detection

The Auto Dirt Fix effect can utilise an automatic dirt and dust detection when no defect map is present. In this next step, you are going to fix the tutorial clip using this automatic detection, rather than the defect map. Create a new stack by clicking the + button in the stacks controls, then create an Auto Dirt Fix effect. In this Auto Dirt Fix effect, de-select Use Defect Map in Detection parameters. While Use Defect Map is not selected, the Detection parameters become available and the effect uses an automatic detection to identify dirt and dust defects instead.

09. Adjusting Detection Paramaters

Click the View button to highlight the detected areas. The Min. Contrast (%) value specifies how different dirt areas need to look from their environment. The lower the minimum contrast value, the more sensitive the defect detection becomes. You can change the value by either typing the desired value into the text box, or clicking inside the box and dragging with the left or middle mouse button. Use the middle mouse button instead of the left mouse button for more fine grained adjustments. The dirt highlight updates to illustrate the effects of the new parameters.

Sampling Dirt

You can also sample a piece of dirt to have PFClean determine suitable a Min. Contrast value. De-select View, then click the Sample button and draw a rectangle around the defect you want to sample. The Min. Contrast value updates and the sampled dirt is fixed automatically.

Play through the clip to see the result of the dirt detection and fixing. As you play for the first time after changing a parameter you can see the results graph filling up. There are many smaller pieces of dust in this clip, so change the minimum Size to 3. While not strictly necessary for this clip, also change the Accuracy setting for the Motion Analysis from Low to Normal. A higher accuracy setting is less likely to introduce motion artifacts on clips containing fast or complex motion. The smoothness value should be set lower when the clip contains complex motion.

Like with the Fix parameters, you can find out more about all the settings in the Auto Dirt Fix reference manual, which will open in your web browser when you click the help effect.

10. Using The Q/A Panel to Revert Fixes

In the case your parameters produce false positives, you can easily delete the unwanted fixes in the Q/A panel. Click the Q/A button to open the panel. Click View to highlight all the fixes in the current frame. You can remove a fix by simply drawing a rectangle around it in the Cinema. Other options are drawing an Ellipse, a freehand Lasso, or painting with a Brush. Select Area and click on a dirt area, to remove the fix. If, after removing a fix you decide that you want to keep the fix, you can delete the undo-area for that fix. Select the undo-area you want to delete and click and confirm the Del button. Click the Q/A button again to return to the effect.

Related Posts


Submit a Comment

Your email address will not be published. Required fields are marked *

Share This

Share This Post On: