<< minMaxLoc | Image operations | subtract >>

scicv >> Image operations > normalize

# normalize

Normalizes an image

### Syntax

    img_out = normalize(img, alpha, beta, normType)

### Parameters

img

  Image (Mat).

alpha

  Norm value or range minimum value (double).

beta

  Maximal range value (double).

normType

  Norm type (double, `NORM_1`, `NORM_2`, `NORM_INF` or `NORM_MINMAX`).

img_out

  Output image (Mat).

### Description

`normalize` normalizes an image or a histogram, so that the image or histogram has a specified norm or range.

There are two modes of normalization, depending on normType argument:

- when set `NORM_1`, `NORM_2`or `NORM_INF`, the norm (1, 2, inf) of the image is normalized to alpha.
- when set to `NORM_MINMAX` the range of the pixel values are normalized to minimal value alpha and maximal value beta.

### Examples

    scicv_Init();

    img = imread(getSampleImage("puffins.png"));

    img_template = imread(getSampleImage("puffin_pattern.png"));
    img_result = matchTemplate(img, img_template, CV_TM_SQDIFF_NORMED);

    gcf().color_map = graycolormap(255);
    colorbar(0, 255);

    // Normalize the match template result
    img_out = normalize(img_result, 0, 255, NORM_MINMAX);

    matplot(img_out);

    delete_Mat(img);
    delete_Mat(img_template);
    delete_Mat(img_result);

### See also

- convertScaleAbs

Report an issue
<< minMaxLoc | Image operations | subtract >>