Manual


Here you can find a set of subroutines for image processing, which hopefully will make your images looking nicer. Currently the following processing modes have been implemented:

combine multiple images into one
clear small defects in the image
cut an object from the image, return it on transparent background
fill selected object with pattern or color
emphasize on object in the image
geometrical transformations
color transformations

1. combine multiple images into one - takes several (current on-line version allows only 2) images and based on selected option and parameters set creates a new one. The 1st uploaded image considered to be the 'base' (the size and the main content come from it) for the output.

By default the second image is resized to the size of the first but it can be cropped if "crop 2d image to the size of the 1st" option is set.

It has following options:

images blending - makes homogeneous blending of images where the fraction of each contributing image is defined by parameter blending coefficient , which varies from 0 - output is the 2d image, to 1 - output is the 1st image.

Example:

blending coefficient set to 0.5


Input:

+

Output:


blending coefficient set to 0.3

Input:

+

Output:


combine by color mask - replaces parts of the 1st image where color value is above the threshold specified by color threshold with corresponding content of the 2d image. color threshold varies from 0 - all content will be replaced to 255 - white areas will be replaced

Example:

Input:

+

Output:


blending with filter - replaces parts of the 1st image specified by the filter selection with corresponding content of the 2d image. Currently there are two filters: Maximum - points with the maximal color value of the 1st image will be replaced, Minimum - points with the minimal color value of the 1st image will be replaced. These options are useful when there is an image with white or black background and you would like to change it on something else.

Example:

Input:

+

Output:

filter:Max

filter:Min


replace box - crops a box specified by the parameter box coordinates (x0 - width coordinate of upper left corner of the box, y0 - height coordinate of upper left corner, x1 - width coordinate of lower right corner, y1 - height coordinate of lower right corner) from the 2d image and put it into the same box on the 1st image. No any scaling applied.

Example:

Input:

+

Output:

combine with gradient - two images blending but instead of homogeneous blending a gradient is applied. Parameter distance defines the square of the limit distance from the 1st image center where the blending occurs.

Example:

Input:

+

Output:

combine by shape mask - a circle mask is created according to provided parameters: x,y - center of the circle, and squared radius. The 2d image is placed inside the mask applied to the 1st image

Example:

Input:

+

Output:


2. clear small defects - clear small defects in the image (points, stripes), makes some kind of smoothing according to selected filter. Can be applied to monochrome or colored image (has to be specified). Optionally can be applied only within a limited by rectangular box area if the box parameter is set (box is defined by 4 values as described above). coefficient parameter is used in the filter and needs some adjustment for better result.

Example:

Input:

Output:

filter: Gaussian; koef=2

filter:Median; koef=3

filter:TV denoise; koef=15

3. cut an object - cuts an object containing the point specified by x,y or the biggest one if no point is provided, returns it on transparent background. Optionally can make smooth border of the object (recommended).color threshold - quite sensitive and important parameter, when the object is complicated (many internal lines and color change), its fine adjustment can be useful, it varies from 0 to 255.

Example:

Input: (koef=170)

Output:

4. remove an object - reciprocal to <a name="cobj" id="cobj">cut an obj</a> instead of returning the object, it returns the 1st image where the selected by x,y object is replaced with a color of the point specified by color coordinates or with a pattern from another image. A band for the color threshold can be specified here.

Example:

Input:(koef=170)

Output:

5. emphasize object - emphasizes an object specified by x,y making smoother background

Example:

6. geometrical transform - a set of geometrical transformations which can be applied to an image. These include:


Rotation requires an angle of the rotation to be specified; transpose requires the method to be selected, currently flip left to right or flip top to bottom;

Examples:

Original

Rotation

flip left to right

flip top to bottom

Affine transformation in general case cen be determined as

new(x,y)=A*old(x,y)+B

where A - 2x2 matrix, B - 2 element vector. A and B have to be supplied as data parameter: ( a11, a12, b11, a21, a22, b12).
Special cases:

Examples:

data=[0.5,0,110,0,1,0]

data=[v2/2,-v2/2,200,v2/2,0.107,-30]

data=[0.2,0,200,1,0,-100]

Extent transformations - extend selected box to the size of the image box=data=[x0,y0,x1,y1] - upper left and lower right corners of the selected area

Examples:

Input:
.

Output:
data=[0,0,250,100]

Quad transformations - map a quadrilateral to a rectangle. Here data=[x0, y0, x1, y1, x2, y2, y3, y3] - upper left, lower left, lower right and upper right corners of the selected area in the input image

Examples:

Input:
.

Output:
data=[100,0,50,200,250,230,280,0]

data=[0,0,240,0,0,150,250,160]

Mesh transformations map a number of source quadrilaterals in one operation.

Perspective transformations - map a quadrilateral into another one. Here mapping is done as

So, data=[a, b, c, d, e, f, g, h]

Providing size coefficient parameter one can increase or decrease the image. The coefficient is used as multiplicator of the current image size

7. color transform - a set of color transformations which can be applied to an image. These include:



several transformations here can be applied simultaneously. For HUE transformation coefficient - rotation in the color space and adjustment - need to be specified

Examples:

mask

saturate

invert

solarize

brightnes & contrast


hue