2.5K views

Uploaded by pi194043

Overview of Stack Based implementation of horizontal scan line region growing algorihtm

save

- automatic white balance algorithm 1
- Adaptive Skin Color Detector
- Dense optical flow expansion based on polynomial basis approximation
- Continuous Emission Hidden Markov Model for sequence classification
- A detailed descriptions and results for different color constancy algorithms
- FASOGBONLab02report
- shape classification using Histogram of oriented gradients
- Gesture Recognition using Hidden Markov Mode
- Overview of Good Features to Track Feature Detector
- Region Growing Algorithm For UnderWater Image Segmentation
- A simple color balance algorithm
- Image enhancement using Fusion
- Single Passs Connected Component Labelling
- Gaussian Multivariate Distribution -Part 1
- Multi Class Logistic Regression Training and Testing
- OpenCL Heterogeneous parallel program for Gaussian Filter
- Symmetic Nearest Neighbour Anisotropic 2D image filter
- Control Limited Adaptive Histogram Equalization for Image Enhancement
- Spatio Temporal Feature extraction using harris 3d corner detector
- Fitting Line to set of Points
- OpenCL Heterogenenous program for Image Processing - ColorSpace conversion BGR-HSV,HSV-BGR,BGR-GRAY
- Fast 3D Extension of Fast Feature Detection for SpatioTemporal Corner Detection
- OpenCL 2D Convolution Using Separable Filters -Box Filter
- temporal filters
- Noise Models in Image processing
- Feature Detection - Overview of Harris Corner Feature Detection
- Overview and Implementation of Fast Corner Detection Method
- Uniform Color Quantization
- OpenCL Image Convolution Filter - Box Filter
- Image Degradation and Restoration Model
- OpenVision Library Gaussian Mixture Model Implementation
- ARM Neon Optimization for image interleaving and deinterleaving
- A linear channel filter
- Fast 2D Separable Symmetric/Anti-Symmmetric Convolution
- Implementation of discrete hidden markov model for sequence classification in C++ using Eigen
- Markov chain implementation in C++ using Eigen
- polynomial approximation of a 2D signal
- Modified Canny Edge Detection
- Polynomial Approximation of 2D image patch -Part 2
- Gaussian Multivariate Distribution -Part 1
- Multi Class Logistic Regression Training and Testing
- Compiling Native C/C++ library for Android
- C++ virtual functions and abstract class
- C++ static members and function
- Mean Shift Tracking
- Uniform Local Binary Pattern and Spatial Histogram Computation
- Normalized convolution for image interpolation
- Tan and Triggs Illumination normalization
- Mean Shift Algorithm
- Local Binary Pattern
- C++ Inheritance
- C++ Const,Volatile Type Qualifiers
- Polynomial Approximation of 1D signal
- Integral Image for Computation of Mean And Variance
- Random Ferns for Patch Description
- Embedded Systems Programming with ARM on Linux - Blinking LED
- C++ Class Members and friends
- Reporte de Evaluacion Completa
- Capitulo 7. Instrumentacion Virtual.pdf
- CONFIGURACION PROTOCOLO OSPF
- SLAM With Learned Object Recognition
- online chatting
- Semaphore-twinsoft-manual Ojo
- Manual Windows 2008 Server ByReparaciondepc Cl
- Arduino
- DPC3290FS - Brochure.pdf
- AUDITORIA INFORMATICA.docx
- cc430f6137
- Agentes Inteligentes
- 8259 Programmable Interrupt Controller
- ATmega2560 Características Programación y Simulación
- Logic Studio Instalación del software
- CCNA 1 Exam Networking Answers_ CCNA Exploration 1 4.0 - FINAL Exam Answers Vers
- User Guide Addcad 2014 for Autocad and Lt
- preguntas sobre Ingenieria de Software
- Trabalho Individual(Unopar)
- Software Development Plan
- Nota BOP
- Get Started With MATLAB 2010-Student Handout
- Herramientas Web 2.0 en Medicina
- Context based Document Indexing and Retrieval using Big Data Analytics - A Review
- to Retie
- Ole
- The Papeline BAE System
- GUIA8-DFD
- MU Modulo Logistica Pedidos
- El lenguaje de programación C maneja 3 tipos de datos primitivos

You are on page 1of 15

Pi19404

March 1, 2013

Contents

Contents

2 |

??

0.1 Introduction

In this document we will look at task of image segmentation and use region growing algorithms to achieve this task and its application to underwater image segmentation.

The goal of image segmentation is to partition the image into subregions with homogeneous intensity (color or tex- ture) properties which will hopefully correspond to objects or object parts. Region growing algorithms is a method to extract similar parts of image. The region growing algorithms checks for similarity of the neighborhood pixels of given initial seed point and labels the pixels that meet the similarity criteria and mean value of region foor similarity evaluation is determined. The neighborhood pixels of the newly labelled points are analysed and similarity comparison is performed with newly computed mean value. In this way neighborhood can grow in a iterative manner till stopping criteria is met.

Conider a set R which contains pixels that belongs to the region that is required to be segmented.Let set S represent a set of pixels called seed points. Seed points are pixels that is known to belong to object desired to be segmented.

3 |

??

For the present application we assume that we need identify the region in the image to which seed pixels belong ie other region of the image are not required. For every seed points 4/8 connected neighbors of seed point are analyzed for similarity with the seed pixel using some predefined criteria. Thus all the neighborhood pixels are marked to be compared with seed pixel. If the connected neighbor satisfies the criteria then it is included labelled as desired region and neighbor is unmarked. While all the connected neighbors of the present neighbor are marked. This process continues till no marked pixels remains which results in segmentation of region to which seed pixel belongs. As the region grows the similarity comparision can be peformed with the mean value of region rather than just the seed pixels.

We will use a recurive algorithm to implement the task. Input to algorithm is input image and seed pixel location,the output is a labelled image. Input to recurive function will be location of pixel required to be analyzed. Inital call to recurive function is the seed pixel location. The function calls a ColorDistance function to check for similarity of the given pixel with the seed pixel provided the pixel has not been analyzed already. If the distance is less than a specified threshold pixel is marked in the output labelled image and recursive calls are initiated to neighbors of the current pixel. Labelling the output image indicates the pixel has been analyzed and any call to function labelled pixel locations will return without performing any action.

4 |

??

As algorithm progress all connected neighbors of seed pixels are used to initiate recursive calls .If these pixels satisfy the similarity criteria use recurive calls for their connected neighbors and so on. In this way all the connected pixel of seed pixel satisfying the similarity criteria are labelled in the output image and segmentation is achieved. The we can either consider 4/8 connected beighbors for analysis. In the present implementation we use a threshold of 20 . If euclidean distance between two pixels is less than 20 we consider the pixels to be similar. We can see that region growing algorithm stop at places when reflections of object fall on the water.Increasing the threshold is one option to overcome this problem.But it is not guranteed to work in all scenarios.This is shown below. The seed is choosen at location within the shown object. In

(a) Image

(b) thresh 20

(c) thresh 50

(d) input 2

(e) thresh 50

(f) thresh 80

the second image we can see than even with high threshold of 80,the white over exposed region will never be labelled as belonging

5 |

??

Image Segmentation - Region Growing Algorithm For UnderWater Image Segmentation to the object.

The standard region growing algorithms use only color measurements for similarity criteria.Underwater images are affected by reflections and crinkle effects which leads to over exposure in some parts of the object being segmented. Due to these effects a large intensity change in observed in region withing the object being segmented ie sharp edge are observed within the object region. The standard Region growing algorithms would terminate at these region since large color difference is encountered wrt to seed pixel color or color of object required to be segmented. Thus to overcome this we compute the similarity measure based on the color,exposedness of region as well as local edge intensity. One simple technique is to check the distance ered to white color.If the distance is close to color and within a specified threshold ,which similarity threshold then we will include pixel object. of pixel being considwhite than seed pixel can be independent as belonging to the

However this modification may not always provide desired sementation as shown in the images below.

In the second image we can see that due to connected white colored pixels the region grows belong the desired object. To over the effect of seeded region growing algorithm growing belond the object we use edge information. We compute the edge map using canny edge detection technique. mean value of edge about a small neighborhood of point being analysed is computed and added to the distance computed to white colored pixels. Thus if the color is white but region has a edge the distance will increase and if region has strong edge it will increase the distance belong the threshold and region growing will stop. though pixel is white in

6 |

??

(a) input 2

(b) thresh 80

(c) modified

(d) Image

(e) thresh 20

(f) thresh 50

color and connected to original object. Also we make one more modification of reducing the distance threshold to white pixels keeping it half of color threhold. In the above image the hand along with the object is de-

(a) Image

(b) thresh 20

Figure 3: Using Edge Map

tected since the color threshold is kept high.But the main point

7 |

??

Image Segmentation - Region Growing Algorithm For UnderWater Image Segmentation to note is that due to addition of edge map the region does not overflow significantly from the desired object boundary

0.7.1 Color Distance Computation

The color distance used is simply euclidean color distance between two color vectors. and is defined by function colorDist

1 2 3 4 5 6 7 8 9 10 11 12

float seed_fill :: ColorDist3 ( Scalar a , Scalar b ) { float a1 = a [2]; float a2 = a [1]; float a3 = a [0]; float b1 = b [2]; float b2 = b [1]; float b3 = b [0]; float dist =((( a1 - b1 ) *( a1 - b1 ) +( a2 - b2 ) *( a2 - b2 ) +( a3 - b3 ) *( a3 - b3 ) ) ) ; dist = sqrt ( dist /3) ; return dist ; }

The edge map computation is performed before calling the seeded region growing algorithm. First A Laplacian of the RGB image is taken and mean value of all 3 channels is computed. Since edge detection also enhances the noise in the image gaussian blur is applied on the image before taking the laplacian.

1 2 3 4 5 6 7 8

Mat edge1 ; cv :: GaussianBlur ( input , input , Size (3 ,3) ,1) ; cv :: Laplacian ( input , edge1 , input . depth () ,1 ,1) ; vector <Mat > em ; cv :: split ( edge1 , em ) ; cv :: add ( em [0] , em [1] , edge ) ; cv :: add ( edge , em [2] , edge ) ; edge = edge /3;

8 |

??

The requirement is to obtain a normalized edge map that returns a value between 0-255. The tranformation function should give a value must be large for stronger edges and small for weak edges. The transformation function is monotonic. The transformation function should give a variation of edge map value must gradually increase/decrease according to the edge strength. A exponential transformation function satisfies these criteria. The transformation function used is

g

0

(x) =

exp(

I (x; y )=K )

K is parameter that determine how fast the edge strength falls Since value corresponding to the maximum edge intensity isg (x) = exp(1=K )

0

g (x)

=1

(x)

(1)

1 2 3 4 5 6 7

double K =1; edge . convertTo ( edge , CV_32FC (3) , -1.0/(255.0* K ) ,0) ; cv :: exp ( edge , edge ) ; cv :: threshold ( edge , edge , std :: exp ( -1/ K ) +0.001 , 0 , THRESH_TOZERO ) ; edge =1 - edge ; edge =255* edge ; edge . convertTo ( edge , CV_8UC (1) ,1 ,0) ;

In the code the main method to calculate the similarity is ColorDist The Color based similarity measure is computed by the function ColorDist3 which is just the euclidean distance between two RGB color vector.

9 |

??

Image Segmentation - Region Growing Algorithm For UnderWater Image Segmentation The Euclidean distance of the current pixel with the seed pixel color and with mean pixel intesity value about small neighborhood or current pixel with the white pixel is computed We define a small neighborhood size over whih the mean is computed the default value is 5. The ROI is determined as follows

1 2 3 4 5

int s1 =x - bsize /2 >=0? x - bsize /2:0; int s2 =y - bsize /2 >=0? y - bsize /2:0; int s3 =( x - bsize /2+ bsize ) <= width ? bsize :x - bsize /2+ bsize - width -1; int s4 =( y - bsize /2+ bsize ) <= height ? bsize :y - bsize /2+ bsize - height -1; Rect r = Rect ( s1 , s2 , s3 , s4 ) ;

The mean value of the image pixels and edge pixels are computed in the defined ROI about the current pixel.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

Mat rx = edge ; uchar * ptr1 =( uchar *) input . data ; uchar * ptr =( uchar *) rx . data ; for ( int i1 =0; i1 < r . height ; i1 ++) { for ( int j1 =0; j1 < r . width ; j1 ++) { f1 = f1 + ptr [( i1 + r . y ) * rx . step + rx . channels () *( j1 + r . x ) ]; f4 = f4 + ptr1 [( i1 + r . y ) * input . step + input . channels () *( j1 + r . x ) ]; f5 = f5 + ptr1 [( i1 + r . y ) * input . step + input . channels () *( j1 + r . x ) +1]; f6 = f6 + ptr1 [( i1 + r . y ) * input . step + input . channels () *( j1 + r . x ) +2]; } } f1 = f1 /( r . width * r . height ) ; f4 = f4 /( r . width * r . height ) ; f5 = f5 /( r . width * r . height ) ; f6 = f6 /( r . width * r . height ) ;

Next we compute the distance of the mean intensity value with white color value

1 2

10 |

??

Image Segmentation - Region Growing Algorithm For UnderWater Image Segmentation The final step is to specify a threshold .If the distance dist2 to white color value plus mean edge intesity is less than specifed threshold then it belongs to object and we return a similarity value of 0 else we compare the color distane measure to seed pixel value with threshold and decide if the pixel belongs to object or not.

In the line scan method ,the pixels in the same vertical/horizontal as the seed/current pixel are scanned.The length of scan is pre defined For the present example we set the minmum extent to be 0 and maximum extent to be image height/width. Here we look at horizontal scan algorithm. Consider a object to be segmented. Consider a seed pixel chosen within the object being segmented. and a horizontal line containing the seed pixel. The point S shown the figure is the seed pixel.

The input to scan line algorithm are a pair of seed points points lying on a horizontal line. The pair of points have different x coordinates and same y co-ordinates. and if line above/below current line is to be scanned next. The scan line algorithm consists of two step ,finding the seed points and next is to mark the pixels between the seed points.

11 |

??

0.8.1 Initialization

The Seed Points can be found by identifying the points at which the scan line intersects the edges of image. Initial pair of seed points are the same as input seed pixel point. From the current point we keep on checking all the pixels to the left and right of current pixel using similarity criteria. The points at which the similarity criteria is not satisfied are local edge points. Points A,B shown in the figure determine the seed points.

Let us assume we have seed points of current line. Next step is to determine extents of line above and below.Since pixel intensity cannot change abrubtly hence extents will be close to the points A and B. A point with same x co-ordinate as A and y co-ordinate of line above is one of seed points and other seed point is point with same co-ordinate as B and y co-ordinate is line above current line.

Thus for the above line we obtain the left edge as point A or point to left of A. and the right edge as point B or point to right of B. Let these new points be denoted as C and D. From point C we move towards left filling points which satisfy similarity criteria. If we reach the point D.Then Line has been successfully filled and scan can be performed for the line above and below the present line,

12 |

??

Image Segmentation - Region Growing Algorithm For UnderWater Image Segmentation From point C as we move towards left we may encounter a edge before we reach point D Line segment (E ; F ) and (G; H ) denotes such a case. Thus line segment (E ; F ) and (G; H ) are considered the scanned line and line above/below this line segment will be scanned. Similarity if we move from the point D and end before reaching point C, then this new line segment will be filled and lines above and below this line segment will be scanned next. In this way entire image will be parsed by using connected line segments.

0.9 Implementation

In present application we use a stack based implementation. The elements of stack contain iformation above the line to be scanned. A class Line_Element is used to define the entry.It will contain the right and left co-ordinates of current line segment,y co-ordinate line segment above/below

1 2 3 4 5 6 7

The first operation is to obtain the left and right edges of the line This is done by scanning left/right from the left and right pixel values.

1 2 3 4 5 6 7

for ( xa = p . left ; xa >= nMinX && check_color ( xa , p . y ) == true ; xa - -) ; if ( xa < p . left ) xa = xa +1; for ( xb = p . right ; xb < nMaxX && check_color ( xb , p . y ) == true ; xb ++) ; if ( xb > p . right ) xb = xb -1;

13 |

??

From left end of the line we determine the line segments encountered as we move towards the right and add pixel of line above and below these line segments to stack. In the below code segment.

xa

and

xb

14 |

??

left = xa ; do { for ( xa = left ; xa < nMaxX && check_color ( xa , p . y ) == true ; xa ++) { SetPixel ( xa , p .y , fill_color ) ; } if ( xa > left ) { lines . push ( line_element ( left , xa -1 , p .y -1 , - p . nexty ) ) ; lines . push ( line_element ( left , xa -1 , p . y +1 , - p . nexty ) ) ; } for (; xa < xb && check_color ( xa , p . y ) == false ; xa ++) ; left = xa ; } while ( xa < xb ) ;

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Static color threholds are being used presently.A adaptive threshold would be required based on information content present in the image as well as strenght of edge . Look for further improvements in stack based algorithms. A better color distance criteria for similarity matching is required. Analysis in different color space and distance other than eculidean will be considered in the future work.

0.11 Code

The class seed_fill_stack defines a class for stack based scan line algorithm. The input to algorithm is input image and seed pixel location and output is labelled image. Code is available in repository https://github.com/pi19404/m19404/tree/master/RegionGrowing

15 |

??

- automatic white balance algorithm 1Uploaded bypi194043
- Adaptive Skin Color DetectorUploaded bypi194043
- Dense optical flow expansion based on polynomial basis approximationUploaded bypi194043
- Continuous Emission Hidden Markov Model for sequence classificationUploaded bypi194043
- A detailed descriptions and results for different color constancy algorithmsUploaded bypi194043
- FASOGBONLab02reportUploaded byPeter Fash Faspet
- shape classification using Histogram of oriented gradientsUploaded bypi194043
- Gesture Recognition using Hidden Markov ModeUploaded bypi194043
- Overview of Good Features to Track Feature DetectorUploaded bypi194043
- Region Growing Algorithm For UnderWater Image SegmentationUploaded bypi194043
- A simple color balance algorithmUploaded bypi194043
- Image enhancement using FusionUploaded bypi194043
- Single Passs Connected Component LabellingUploaded bypi194043
- Gaussian Multivariate Distribution -Part 1Uploaded bypi194043
- Multi Class Logistic Regression Training and TestingUploaded bypi194043
- OpenCL Heterogeneous parallel program for Gaussian FilterUploaded bypi194043
- Symmetic Nearest Neighbour Anisotropic 2D image filterUploaded bypi194043
- Control Limited Adaptive Histogram Equalization for Image EnhancementUploaded bypi194043
- Spatio Temporal Feature extraction using harris 3d corner detectorUploaded bypi194043
- Fitting Line to set of PointsUploaded bypi194043
- OpenCL Heterogenenous program for Image Processing - ColorSpace conversion BGR-HSV,HSV-BGR,BGR-GRAYUploaded bypi194043
- Fast 3D Extension of Fast Feature Detection for SpatioTemporal Corner DetectionUploaded bypi194043
- OpenCL 2D Convolution Using Separable Filters -Box FilterUploaded bypi194043
- temporal filtersUploaded bypi194043
- Noise Models in Image processingUploaded bypi194043
- Feature Detection - Overview of Harris Corner Feature DetectionUploaded bypi194043
- Overview and Implementation of Fast Corner Detection MethodUploaded bypi194043
- Uniform Color QuantizationUploaded bypi194043
- OpenCL Image Convolution Filter - Box FilterUploaded bypi194043
- Image Degradation and Restoration ModelUploaded bypi194043

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

- Reporte de Evaluacion CompletaUploaded byoctavio paz secundaria
- Capitulo 7. Instrumentacion Virtual.pdfUploaded byBicek Crew
- CONFIGURACION PROTOCOLO OSPFUploaded byJose Angel Romero Rodriguez
- SLAM With Learned Object RecognitionUploaded bySami Ullah
- online chattingUploaded bySuman Dey
- Semaphore-twinsoft-manual OjoUploaded byLuis Isidro Jaimes Amaya
- Manual Windows 2008 Server ByReparaciondepc ClUploaded byHermis Ramos Espinal
- ArduinoUploaded byĐèşķi Ŋğ
- DPC3290FS - Brochure.pdfUploaded byYogo Susilo
- AUDITORIA INFORMATICA.docxUploaded bysiulosvi14
- cc430f6137Uploaded bygspoletto
- Agentes InteligentesUploaded byjuanw
- 8259 Programmable Interrupt ControllerUploaded byramkumarraja
- ATmega2560 Características Programación y SimulaciónUploaded byGuillermo Fernández
- Logic Studio Instalación del softwareUploaded byClau Fernández López
- CCNA 1 Exam Networking Answers_ CCNA Exploration 1 4.0 - FINAL Exam Answers VersUploaded byotispete2572
- User Guide Addcad 2014 for Autocad and LtUploaded byRandal Ohlgart
- preguntas sobre Ingenieria de SoftwareUploaded bybjulypaola
- Trabalho Individual(Unopar)Uploaded byJean Carlos da Silva
- Software Development PlanUploaded byTom Welch, MBA, CPC, PMP, MVP
- Nota BOPUploaded bymckiku
- Get Started With MATLAB 2010-Student HandoutUploaded bySteven Hertz
- Herramientas Web 2.0 en MedicinaUploaded byCarlo Vinicio Caballero-Uribe MD
- Context based Document Indexing and Retrieval using Big Data Analytics - A ReviewUploaded byEditor IJRITCC
- to RetieUploaded bykaren
- OleUploaded byHazarath Vadapalli Annangi
- The Papeline BAE SystemUploaded byprueba
- GUIA8-DFDUploaded byLiliänä ThøvAr
- MU Modulo Logistica PedidosUploaded byWilson Barba
- El lenguaje de programación C maneja 3 tipos de datos primitivosUploaded bySergio Torres