# featureMatrix

Image scattering feature matrix

Since R2019a

## Syntax

``smat = featureMatrix(sf,im)``
``smat = featureMatrix(sf,sc)``
``smat = featureMatrix(___,'Transform',transformtype)``

## Description

example

````smat = featureMatrix(sf,im)` returns the scattering feature matrix for the wavelet image scattering network, `sf`, and the input image, `im`. `im` is a real-valued 2-D (M-by-N) or 3-D matrix (M-by-N-by-3). If `im` is a 3-D matrix, the size of the third dimension must be 3. If `im` is a 2-D matrix, `smat` is Np-by-Ms-by-Ns, where Np is the number of scattering paths and Ms-by-Ns is the resolution of the scattering coefficients. If `im` is a 3-D matrix, `smat` is Np-by-Ms-by-Ns-by-3.```
````smat = featureMatrix(sf,sc)` returns the scattering feature matrix for the cell array of scattering coefficients, `sc`. `sc` is obtained from the `scatteringTransform` method of the wavelet image scattering network.```
````smat = featureMatrix(___,'Transform',transformtype)` applies the transformation specified by `transformtype` to the scattering coefficients. Valid options for `transformtype` are `'log'` and `'none'`. If unspecified, `transformtype` defaults to `'none'`. You can use this syntax with any of the previous syntaxes.```

## Examples

collapse all

This example shows how to obtain the feature matrix for a wavelet image scattering network.

Load the `xbox` image. Create an image scattering network suitable for the image.

```load xbox sf = waveletScattering2('ImageSize',size(xbox))```
```sf = waveletScattering2 with properties: ImageSize: [128 128] InvarianceScale: 64 NumRotations: [6 6] QualityFactors: [1 1] Precision: "single" OversamplingFactor: 0 OptimizePath: 1 ```

Obtain the feature matrix.

`smat = featureMatrix(sf,xbox);`

## Input Arguments

collapse all

Wavelet image scattering network, specified as a `waveletScattering2` object.

Input image, specified as real-valued 2-D matrix or 3-D matrix. If `im` is 3-D, `im` is assumed to be a color image in the RGB color space, and the size of the third dimension must equal 3. The row and column sizes of `im` must match the `ImageSize` property of `sf`.

Scattering coefficients, specified as a cell array. `sc` is obtained from the `scatteringTransform` method of the image scattering network.

Transformation to apply to the scattering coefficients:

• `'none'`: No transformation is applied to the scattering coefficients.

• `'log'`: The natural logarithm is applied to the scattering coefficients.

## Output Arguments

collapse all

Scattering feature matrix for the 2-D scattering network `sf`, returned as a real-valued array. If `im` is a 2-D matrix, `smat` is Np-by-Ms-by-Ns, where Np is the number of scattering paths and Ms-by-Ns is the resolution of the scattering coefficients. If `im` is a 3-D matrix, `smat` is Np-Ms-by-Ns-by-3.

## Version History

Introduced in R2019a