Main Content

isfilterseparable

Determine whether filter coefficients are separable

Description

isSeparable = isfilterseparable(H) returns logical 1 (true) when the filter kernel H is separable, and 0 (false) otherwise.

[isSeparable,hcol,hrow] = isfilterseparable(H) also returns the vertical coefficients hcol and horizontal coefficients hrow when the filter kernel, H, is separable. Otherwise, hcol and hrow are empty.

example

Examples

collapse all

Determine if the Gaussian filter created using the fspecial function is separable.

Create a Gaussian filter.

twoDimensionalFilter = fspecial('gauss');

Test the filter.

[isseparable,hcol,hrow] = isfilterseparable(twoDimensionalFilter)
isseparable = logical
   1

hcol = 3×1

   -0.1065
   -0.7870
   -0.1065

hrow = 1×3

   -0.1065   -0.7870   -0.1065

Input Arguments

collapse all

Filter kernel, specified as a non-sparse 2-D numeric or logical matrix.

Output Arguments

collapse all

Filter is separable, returned as logical 1 (true) when the filter is separable and 0 (false) when the filter is not separable.

Data Types: logical

Vertical coefficients when the filter kernel H is separable, returned as a numeric vector. When H is not separable, hcol is empty. If H is of data type single, then hcol is also of data type single. Otherwise, hcol is of data type double.

Horizontal coefficients when the filter kernel H is separable, returned as a numeric vector. When H is not separable, hrow is empty. If H is of data type single, then hrow is also of data type single. Otherwise, hrow is of data type double.

More About

collapse all

Algorithms

The isfilterseparable function uses the singular value decomposition svd function to determine the rank of the matrix.

Version History

Introduced in R2006a