conndef
Create connectivity array
Description
Examples
Create 2-D Connectivity Array with Minimal Connectivity
Create a 2-D connectivity array.
conn = conndef(2,'minimal')
conn = 3×3
0 1 0
1 1 1
0 1 0
Create 2-D Connectivity Array with Maximal Connectivity
Create a 2-D connectivity array.
conn = conndef(2,'maximal')
conn = 3×3
1 1 1
1 1 1
1 1 1
Create 3-D Connectivity Array with Minimal Connectivity
Create a 3-D connectivity array.
conndef(3,'minimal')
ans = 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
num_dims
— Number of dimensions
positive integer
Number of dimensions, specified as a positive integer.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
type
— Type of neighborhood connectivity
'minimal'
| 'maximal'
Type of neighborhood connectivity, specified as 'minimal'
or
'maximal'
Value | Description |
---|---|
| Defines a neighborhood whose neighbors are touching the
central element on an ( |
| Defines a neighborhood including neighbors that touch
the central element in any way; it is |
Data Types: char
| string
Output Arguments
conn
— Pixel connectivity
3-by-3-by...-3 logical array
Pixel connectivity, returned as a 3-by-3-....-by-3
logical array. conn
is symmetric
about its center element. See Specifying Custom Connectivities for more
information.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
conndef
supports the generation of C code (requires MATLAB® Coder™). For more information, see Code Generation for Image Processing.When generating code, the
num_dims
andtype
arguments must be compile-time constants.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Usage notes and limitations:
When generating code, the
num_dims
andtype
arguments must be compile-time constants.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)