1.4K views

Uploaded by pi194043

Single Pass Connected Component Labelling Algorithm
In the Single Pass connected component labelling algorithm each pixel is visited approximately once. The algorithm can be applied to color as well as binary images. The algorithm uses a distance measure to compare if the pixels belong to same component or not. The algorithm uses a decision criteria to decide if the connected component analysis if to be performed for the given pixel. Th

save

You are on page 1of 5

In the Single Pass connected component labelling algorithm each pixel is visited approximately once. The algorithm can be applied to color as well as binary images. The algorithm uses a distance measure to compare if the pixels belong to same component or not. The algorithm uses a decision criteria to decide if the connected component analysis if to be performed for the given pixel. The algorithm outputs a labelled matrix indicating connected components. For binary image the distance function returns a 1 if pixel intensities are same and a 0 if pixel intensities are dierent. For binary image the decision criteria is to check if pixel intensity is 255 and perform connected component analysis The distance function is also used to check if pixel is a pixel of interest by comparing it with a predened foreground color.Only if the pixel Algorithm is as follows :

check if pixel is labelled or not . if the pixel is not labelled check if decision criteria is satised. Assign a new label to pixel . Push the current pixel in the stack. pop pixel from top of stack. For each pixel in the stack check its 4/8 neighbours which are not

If neighbour satises distance criteria push neighbourhood pixels to the Continue this opration till stack is empty. Loop through all rows and columns.

Single Pass Connected Component Labelling Algorithm Using this method each pixel is visited approximately once.

For color image we can specify the decision criteria or decision threshold according to the threshold.Also the algorithm can be used on any color space.

Sample Code

Sample Code

s t r i n g winName2 ="binary image " ; s t r i n g winName3 =" l a b e l l e d image " ; i n t d i s t 3 ( Vec3b a , Vec3b b , i n t r a d i u s 1 ) { i f ( b . v a l [0]==255) return 1; else return 0; } i n t d i s t 4 ( Vec3b a , Vec3b b , i n t r a d i u s 1 ) { i f ( ( abs ( b . v a l [0] a . v a l [0]))==0 ) return 1; else return 0; } void connected (Mat dst ) { Mat l a b e l ; dst . copyTo ( l a b e l ) ; l a b e l . convertTo ( l a b e l , CV_32FC3, 1 , 0 ) ; l a b e l . setTo ( cv : : S c a l a r : : a l l ( 0 ) ) ;

Vec3b v0 ; v0 . v a l [ 0 ] = 0 ;

Sample Code

v0 . v a l [ 1 ] = 0 ; v0 . v a l [ 2 ] = 2 5 5 ; f l o a t l a b e l i =0; i n t l l =100; i n t r a d i u s 1=s p a t i a l R a d ; i n t k=0; i n t neighbor [ 1 6 ] = { 1, 1, 0 , 1 , 1 , 1 , 1 ,0 , 1 ,0 , 1 ,1 , 0 , 1 , 1 , 1 } ; i n t neighbor1 [ 8 ] = { 1 ,0 , 0 , 1 , 1 , 0 , 0 , 1 } ; i n t r a d i u s =3; f o r ( i n t i =1; i <dst . c o l s 1; i ++) { f o r ( i n t j =1; j<dst . rows 1; j++) { Vec3b v1=dst . at<cv : : Vec3b>(j , i ) ; Vec3f l=l a b e l . at<Vec3f >(j , i ) ; i f ( d i s t 3 ( v0 , v1 , r a d i u s 1 )==1 && ( f l o a t ) l . v a l [0]==0) { stack <CvPoint> p o i n t s ; p o i n t s . push ( cvPoint ( i , j ) ) ; l l = l l +10; l a b e l i=rand ()%255; Vec3f l ; l . v a l [0]= l a b e l i ; l . val [1]=0; l . val [2]=0; l a b e l . at<Vec3f >(j , i )= l ;

w h i l e ( ! p o i n t s . empty ( ) )

Sample Code

i n t y1=p . y+neighbor [ 2 k +1]; Vec3b v2=dst . at<cv : : Vec3b>(y1 , x1 ) ; v1=dst . at<cv : : Vec3b>(j , i ) ; Vec3f l 2=l a b e l . at<Vec3f >(y1 , x1 ) ; i f ( x1>1 && y1 > 1 && x1 < dst . c o l s 1 && y1 <dst . rows 1 && { p o i n t s . push ( cvPoint ( x1 , y1 ) ) ; Vec3f l ; l . v a l [0]= l a b e l i ; l . val [1]=0; l . val [2]=0; l a b e l . at<Vec3f >(y1 , x1)= l ; l=l a b e l . at<Vec3f >(y1 , x1 ) ; } } } } } }

- Connected-Component Labeling (1)Uploaded byAryan Sharma
- OpenCL Heterogeneous parallel program for Gaussian FilterUploaded bypi194043
- Control Limited Adaptive Histogram Equalization for Image EnhancementUploaded bypi194043
- Symmetic Nearest Neighbour Anisotropic 2D image filterUploaded bypi194043
- automatic white balance algorithm 1Uploaded bypi194043
- Computer and Robot Vision, Vol 1Uploaded byDibyendu Mukherjee
- A detailed descriptions and results for different color constancy algorithmsUploaded bypi194043
- OpenCL Heterogenenous program for Image Processing - ColorSpace conversion BGR-HSV,HSV-BGR,BGR-GRAYUploaded bypi194043
- Seeded Region Growing using Line Scan algorithm - Stack base ImplementationUploaded bypi194043
- Fitting EllipseUploaded bypi194043
- Android : shape Classification using OpenCV,JavaCV and SVMUploaded bypi194043
- shape classification using Histogram of oriented gradientsUploaded bypi194043
- Region Growing Algorithm For UnderWater Image SegmentationUploaded bypi194043
- A simple color balance algorithmUploaded bypi194043
- Image enhancement using FusionUploaded bypi194043
- Spatio Temporal Feature extraction using harris 3d corner detectorUploaded bypi194043
- Fitting Line to set of PointsUploaded bypi194043
- Noise Models in Image processingUploaded bypi194043
- Feature Detection - Overview of Harris Corner Feature DetectionUploaded bypi194043
- Overview of Good Features to Track Feature DetectorUploaded bypi194043
- Fast 3D Extension of Fast Feature Detection for SpatioTemporal Corner DetectionUploaded bypi194043
- 16-17_SLL_Phase-Based Binarization of Ancient Document Images.pdfUploaded byMahesh Patil
- OpenCL 2D Convolution Using Separable Filters -Box FilterUploaded bypi194043
- Gesture Recognition using Hidden Markov ModeUploaded bypi194043
- temporal filtersUploaded bypi194043
- OpenCL Image Convolution Filter - Box FilterUploaded bypi194043
- Image Degradation and Restoration ModelUploaded bypi194043
- Dr.AliAbbar3Uploaded byAli Abbar
- Overview and Implementation of Fast Corner Detection MethodUploaded bypi194043
- Uniform Color QuantizationUploaded bypi194043

- Dense optical flow expansion based on polynomial basis approximationUploaded bypi194043
- Continuous Emission Hidden Markov Model for sequence classificationUploaded bypi194043
- Fast 2D Separable Symmetric/Anti-Symmmetric ConvolutionUploaded bypi194043
- OpenVision Library Gaussian Mixture Model ImplementationUploaded bypi194043
- Adaptive Skin Color DetectorUploaded bypi194043
- A linear channel filterUploaded bypi194043
- ARM Neon Optimization for image interleaving and deinterleavingUploaded bypi194043
- Markov chain implementation in C++ using EigenUploaded bypi194043
- Implementation of discrete hidden markov model for sequence classification in C++ using EigenUploaded bypi194043
- polynomial approximation of a 2D signalUploaded bypi194043
- Modified Canny Edge DetectionUploaded bypi194043
- Gaussian Multivariate Distribution -Part 1Uploaded bypi194043
- Multi Class Logistic Regression Training and TestingUploaded bypi194043
- Compiling Native C/C++ library for AndroidUploaded bypi194043
- Polynomial Approximation of 2D image patch -Part 2Uploaded bypi194043
- C++ static members and functionUploaded bypi194043
- C++ virtual functions and abstract classUploaded bypi194043
- Normalized convolution for image interpolationUploaded bypi194043
- Tan and Triggs Illumination normalizationUploaded bypi194043
- Mean Shift TrackingUploaded bypi194043
- Uniform Local Binary Pattern and Spatial Histogram ComputationUploaded bypi194043
- Polynomial Approximation of 1D signalUploaded bypi194043
- C++ Const,Volatile Type QualifiersUploaded bypi194043
- Mean Shift AlgorithmUploaded bypi194043
- Local Binary PatternUploaded bypi194043
- C++ InheritanceUploaded bypi194043
- Embedded Systems Programming with ARM on Linux - Blinking LEDUploaded bypi194043
- C++ Class Members and friendsUploaded bypi194043
- Integral Image for Computation of Mean And VarianceUploaded bypi194043
- Random Ferns for Patch DescriptionUploaded bypi194043

- TERMINOLOUploaded byLuis Gonzales Pineda
- Mode d'Emploi Yamaha 1000 FZSUploaded byMinique27
- Prova 2Uploaded byClaudia Ferreira
- LanchoneteUploaded byJefersonSantos
- imprimir.docxUploaded byAlex Rivas
- Pacific-Gas-and-Electric-Co-Residential-Multifamily-Time-of-Use-ServiceUploaded byGenability
- propagacion citricosUploaded bygranwiston
- Project Planning & ManagementUploaded bywegr
- Champ Stuck Valve IssuesUploaded byprojectkmo
- estructuras o tijeralesUploaded byJorge Luis Galvez Haro
- ITR 2Uploaded byLightRI
- Neck2LectureffUploaded bybibierabia
- 8_F+¡sica IUploaded byVladimiro Ibañez Quispe
- termoacústicaUploaded byobito100
- Mock Finals '10Uploaded bycriscab12345
- Science Over ReligionUploaded byMalak Oda
- 11176-42038-1-PBUploaded byThiago Almeida
- PsoriasisUploaded byneka7
- Fusos Horários - 65 QuestõesUploaded byLucas Viana
- EngineUploaded byAndre Jose Fragoso
- Pda AssessmentUploaded byRavie Oudit
- Statistiques d’IUT, BERNABOTTOUploaded byelmorabit
- Reacciones de Lechero africanoUploaded byMiguel Garcia Bello
- Almacenamiento de Sustancias PeligrosasUploaded byDiana Patricia Zamudio Montaña
- Metrologia - Mecânica e Eletrica AutomotivaUploaded byRocha-85
- Interaccion Portico - MuroUploaded bySantiago Cuellar
- 0702030325 Pod i a Try cUploaded bymk78_in
- General Surgery ReviewerUploaded byNicolette Nuñez
- Resumen LibroUploaded byMarta SB
- Lee Bull Análisis de Una ObraUploaded byClaus