Find Clusters
FINDCLU finds the solitary and clustered pixels in a 2D array of pixels. Recognition of these structures is commonly used in processing of ionizing particles in pixelated detectors or of CCDs in astrophysics.
---PURPOSE---
The function provides the ordered lists of solitary and clustered pixels. A Cluster is defined by the assembly of adjoining pixels which are neighbors. An isolated pixel is a pixel having no neighbors. Neighbors of the pixel P(i,j) are defined as the 8 pixels of the sub-array P(i-1:i+1, j-1:j+1). The function can rapidly process large 2D arrays having a large number of solitaries and large sizes of clusters.
---INPUT---
dimx = number of rows of the array of pixels (int).
dimy = number of columns of the array of pixels (int).
Pos = 2D array (of int) of the indices of positions of the selected pixels, ranked following [list of row indexes; list of column indexes]. (see demo script)
---OUTPUT---
Sol = 2D array (of int) of the ordered indices of positions of the solitary pixels, ranked following [list of row indexes; list of column indexes].
Clu = 2D array (of int) of the ordered indices of positions of the clustered pixels, ranked following [list of row indexes; list of column indexes]. The cluster separator is -1 (-1) in the list of row indexes (of column indexes) of the output array Clu. (see demo script)
---USAGE---
[Sol, Clus] = findclu(dimx, dimy, Pos)
---AUTHOR---
% P. Lautridou (2016)
Tested in Matlab R2016a - Python version also available
Cite As
PLautridou (2026). Find Clusters (https://www.mathworks.com/matlabcentral/fileexchange/57669-find-clusters), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Image Processing and Computer Vision > Image Processing Toolbox > Image Segmentation and Analysis > Image Segmentation >
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 2.0.0.0 | Version 2 - Improved algorithm: the first version can fail for some specific shapes of clusters (worm-like shapes). - Bug fixed at the lines 67-71 of version 1 : the pixel identifier can go up to dimx2*dimy2 (requiring more than 16 bits) |
||
| 1.0.0.0 |
