In this cookbook we show how to make a new compound tool by grouping together a set of existing tools. The new tool sharpens an image with unsharp masking operation. The operation combines the original and a blurred image so that the outcome appears to be sharper than the original image.
Let us walk through the schema below top-down.
- The test image originates from the virtual camera configured in Image Source.
- The image is blurred slightly in Linear Filter Tool using Gaussian filter.
- The original and the blurred images are weighted and added up in Add Images Tool. The weights are calculated in the script as described below.
Syncinput is only used for triggering the calculation. It can be connected to any output in the Image Source which emits a value on each image. For instance,
Image Countare such outputs. The parameters and the script code are shown below.
An example of Unsharp Masking operation is given below. Unsharp masking makes the boundaries of the letters more distinct.
In this chapter we show how to group Linear Filtering, Image Addition and Script tools together as a single Unsharp Masking Tool and store it in your toolbox for future use.
Let's start by showing where we are aiming at. The goal is to create a single tool which can be connected directly to Image Source.
We begin by grouping the relevant tools as a compound. This is done by holding down
Ctrl key and left-clicking on the tools of interest. Then release
Ctrl and right-click to bring up the menu. Select Create Compound.
The input image is already connected to the selected compound so
Image input is created automatically. Parameter
Weight in the script tool must also be added to the set of inputs of the compound. This is done by connecting
Weight to the little + sign on top of the compund box. First click on the white circle next to Weight parameter in the script tool. An arrow appears. Now just click on the + sign to create the parameter.
Image output of Image Addition tool must be defined as the output of the compound tool. Just like above, click on the circle next to the output and connect it to the little x sign at the bottom of the compound box.
Now we are done with the compound. The inputs and the output are shown at top and bottom, respectively.
Right-click on the compound box and select Close Compound to hide details of the compound tool. Then right-click on the tool and select Tool Properties to change the name of the new tool. Click on the pencil icon and type new name
Now you can save the new tool to the library so you can use it later in other projects. For this end, right click on the tool and select Save Tool.
Now the tool appears in User Tools section in the tool menu.
You can now drag and drop it on the canvas just like any native tool. The contents of the compound tool can always be examined by right-clicking