Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

# vision.Minimum System object

Find minimum values in input or sequence of inputs

## Description

Find the minimum values in an input or sequence of inputs.

To track a set of points:

1. Create the `vision.Minimum` object and set its properties.

2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

## Creation

### Syntax

``minObj = vision.Minimum``
``minObj = vision.Minimum(Name,Value)``

### Description

example

````minObj = vision.Minimum` returns an object, `minObj`, that computes the value and index of the maximum elements in an input or a sequence of inputs.```
````minObj = vision.Minimum(Name,Value)` sets properties using one or more name-value pairs. Enclose each property name in quotes. For example, ```minObj = vision.Maximum('RunningMinimum',false)``````

## Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the `release` function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects (MATLAB).

Output minimum value, specified as `true` or `false`. Set this property to `true` to output the Minimum value of the input. This property applies when you set the `RunningMinimum` property to `false`.

Calculate over single input or multiple inputs, specified as `true` or `false`. When you set this property to `true`, the object computes the minimum value over a sequence of inputs. When you set this property to `false`, the object computes the minimum value over the current input.

Output the index of the minimum value, specified as `true` or `false`. This property applies only when you set the `RunningMinimum` property to `false`.

Additional input to enable resetting of running minimum, specified as `true` or `false`. When you set this property to `true`, a reset input must be specified to reset the running minimum. This property applies only when you set the `RunningMinimum` property to `true`.

Condition that triggers resetting of running minimum, specified as as `'Rising edge'`, `'Falling edge'`, ```'Either edge'```, or `'Non-zero'`. This property applies only when you set the `ResetInputPort` property to `true`.

Numbering base for index of minimum value, specified as `'One'` or `'Zero'`. This property applies only when you set the `IndexOutputPort` property to true.

Dimension to operate along, specified as `{'All'}`, `'Row'`, `'Column'`, or `'Custom'`. This property applies only when you set the `RunningMinimum` property to `false`.

Numerical dimension to calculate over, specified as a numerical scalar. This property only applies when you set the `Dimension` property to `'Custom'`.

Enable region-of-interest processing, specified as `true` or `false`. This property applies when you set the `Dimension` property to `'All'` and the `RunningMinimum` property to `false`.

Type of ROI, specified as `'Rectangles'`, '`Lines'`, `'Label matrix'`, or ```'Binary mask'```. This property applies only when you set the `ROIProcessing` property to `true`.

ROI or perimeter calculation, specified as `'Entire ROI'` or `'ROI perimeter'`. This property applies only when you set the `ROIForm` property to `'Rectangles'`.

Calculate statistics for each ROI or one for all ROIs, specified as `'Individual statistics for each ROI'` or ```'Single statistic for all ROIs'```. This property applies only when you set the `'ROIForm'` property to `'Rectangles'`, `'Lines'`, or `'Label matrix'`.

Flag to indicate if any part of ROI is outside input image, specified as `true` or `false`.

This applies when you set the `ROIForm` property to `'Lines'` or `'Rectangles'`.

Set this property to `true` to return the validity of the specified label numbers. This applies when you set the `ROIForm` property to `'Label matrix'`.

### Fixed-Point Properties

Rounding method for fixed-point operations, specified as `'Floor'`, `'Ceiling'`, `'Convergent'`, `'Nearest'` , `'Round'` , `'Simplest'` , or `'Zero'`.

Action to take when integer input is out-of-range, specified as `'Wrap'` or `'Saturate'`.

Product data type, specified as `'Same as input'` or `'Custom'`.

Product word and fraction lengths, specified as a scaled `numerictype` object. This property applies only when you set the `AccumulatorDataType` property to `'Custom'`.

Data type of accumulator, specified as `'Same as product'`, `'Same as input'`, or `'Custom'`.

Accumulator word and fraction lengths, specified as a scaled `numerictype` object. This property applies only when you set the `AccumulatorDataType` property to `'Custom'`.

## Usage

For versions earlier than R2016b, use the `step` function to run the System object™ algorithm. The arguments to `step` are the object you created, followed by the arguments shown in this section.

For example, `y = step(obj,x)` and `y = obj(x)` perform equivalent operations.

### Syntax

``[value,index] = minObj(input)``
``index = minObj(input)``
``[___] = minObj(I,ROI)``
``[___,flag] = minObj(I,ROI)``
``[___] = minObj(I,label,labelNumbers)``
``[___,flag] = minObj(I,label,labelNumbers)``

### Description

example

````[value,index] = minObj(input)` returns the minimum value and index of the input.```
````index = minObj(input)` returns the one-based index of the minimum value when you set the `IndexOutputPort` property to `true` and the `ValueOutputPort` property to `false`. The `RunningMinimum` property must be set to `false`.```
````[___] = minObj(I,ROI)` returns the minimum value in the input image within the given region of interest.```
````[___,flag] = minObj(I,ROI)`additionally returns a flag to indicate whether the given ROI is within the bounds of the image.```
````[___] = minObj(I,label,labelNumbers)` returns the minimum of the input image for a region the labels specified in the `labelNumbers` vector. The regions are defined and labeled in the `label` matrix.```
````[___,flag] = minObj(I,label,labelNumbers)` additionally returns a flag to indicate whether the input label numbers are valid.```

### Input Arguments

expand all

Input data, specified as a vector, matrix, or multidimensional array.

Region of interest, specified as a four-element vector, [x y width height]. This option is available when you set the the `ROIProcessing` property to `true` and the `ROIForm` property to `'Lines'`, `'Rectangles'`, or `'Binary Mask'`.

Label numbers, specified as a matrix. This option is available when you set the `ROIProcessing` property to `true` and the `ROIForm` property to `'Label matrix'`.

Label numbers, specified as a vector. This option is available when you set the `ROIProcessing` property to `true` and the `ROIForm` property to `'Label matrix'`.

### Output Arguments

expand all

Minimum value, returned as the same data type as the input

Index to minimum value, returned as a one-based index.

Flag for valid data, returned as `true` or `false`.

## Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named `obj`, use this syntax:

`release(obj)`

expand all

 `step` Run System object algorithm `release` Release resources and allow changes to System object property values and input characteristics `reset` Reset internal states of System object

## Examples

expand all

Read a color image.

`img = imread('peppers.png');`

Convert the image to grayscale.

`img = im2single(rgb2gray(img));`

Find the maximum.

`hMin = vision.Minimum`
```hMin = vision.Minimum with properties: ValueOutputPort: true RunningMinimum: false IndexOutputPort: true Dimension: 'All' ROIProcessing: false Show all properties ```
`[m, ind] = hMin(img);`