Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

conndef

Create connectivity array

Syntax

  • conn = conndef(num_dims,type)
    example

Description

example

conn = conndef(num_dims,type) returns the connectivity array defined by type for num_dims dimensions. Several Image Processing Toolbox™ functions use conndef to create the default connectivity input argument.

Code Generation support: Yes.

MATLAB Function Block support: Yes.

Examples

collapse all

Create a 2-D connectivity array.

conn = conndef(2,'minimal')
conn =

     0     1     0
     1     1     1
     0     1     0

Create a 2-D connectivity array.

conn = conndef(2,'maximal')
conn =

     1     1     1
     1     1     1
     1     1     1

Create a 3-D connectivity array.

conndef(3,'minimal')
ans(:,:,1) =

     0     0     0
     0     1     0
     0     0     0


ans(:,:,2) =

     0     1     0
     1     1     1
     0     1     0


ans(:,:,3) =

     0     0     0
     0     1     0
     0     0     0

Input Arguments

collapse all

Number of dimensions, specified as a numeric scalar.

Example: conn1 = conndef(2,'minimal')

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Type of neighborhood connectivity, specified as either 'minimal' or 'maximal'

Value

Description

'minimal'

Defines a neighborhood whose neighbors are touching the central element on an (N-1)-dimensional surface, for the N-dimensional case.

'maximal'

Defines a neighborhood including neighbors that touch the central element in any way; it is ones(repmat(3,1,NUM_DIMS)).

Example: conn1 = conndef(2,'minimal')

Data Types: char

Output Arguments

collapse all

Connectivity matrix, returned as a 3-by-3-....-by-3 logical array.

More About

collapse all

Code Generation

This function supports the generation of C code using MATLAB® Coder™. For more information, see Code Generation for Image Processing.

When generating code, the num_dims and type arguments must be compile-time constants.

MATLAB Function Block

You can use this function in the MATLAB Function Block in Simulink.

Introduced before R2006a

Was this topic helpful?