Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

11
Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010

Transcript of Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Page 1: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Image Segmentation

Francesca Pizzorni Ferrarese05/05/2010

Page 2: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Introduction Segmentation is one of the most important steps leading to the analysis

of processed image data, its main goal is to divide an image into parts that have a strong correlation with objects or areas of the real world contained in the image complete segmentation - set of disjoint regions uniquely corresponding with

objects in the input image cooperation with higher processing levels which use specific knowledge of the problem domain is necessary

partial segmentation - regions do not correspond directly with image objects image is divided into separate regions that are homogeneous with respect to a chosen property such as brightness, color, reflectivity, texture, etc. In a complex scene, a set of possibly overlapping homogeneous regions may result. The partially segmented image must then be subjected to further processing, and the final image segmentation may be found with the help of higher level information.

Simple segmentation problems: contrasted objects on a uniform background simple assembly tasks, blood cells, printed characters, etc.

Totally correct and complete segmentation of complex scenes usually cannot be achieved in this processing phase. A reasonable aim is to use partial segmentation as an input to higher level processing.

Segmentation methods global knowledge, e.g. using histogram of image features edge-based segmentations region-based segmentations

Characteristics used in edge detection or region growing: brightness, texture, velocity field 

Page 3: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Hough Transform

The Hough Transform (HT) is a robust method for finding lines in images that was developed by Paul Hough.

The main idea for the HT is as follows: For each line L, there is a unique line l perpendicular to L which passes through the

origin. l has a unique distance and angle from the horizontal axis of the image. This angle

and distance define a point in the parameter space, sometimes known as Hough space.

A point in image space has an infinite number of lines that could pass through it, each with a unique distance and angle.

This set of lines corresponds to a sinusoidal function in parameter space. Two points on a line in image space correspond to two sinusoids which cross at a point in parameter space.

That point in parameter space corresponds to that line in image space, and all sinusoids corresponding to points on that line will pass through that point.

The real solution to implement this algorithm is to quantize the parameter space by using a 2D array of counters, where the array coordinates represent the parameters of the line; this is commonly known as an accumulator array.

The HT method for finding lines in images generally consists of the following three stages:1. Perform accumulation on the accumulator array using the binary edge image.2. Find peak values in the accumulator array 3. Verify that the peaks found correspond to legitimate lines, rather than noise.

Page 4: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Hough Transform

The MATLAB has a function called hough that computes the Hough Transform.

Esercizio 1 Costruire un’immagine che contenga pixel bianchi

isolati applicare la trasformata di Hough e visualizzare il risultato

Page 5: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Hough Transform Esercizio 2

Caricare l’immagine beatles.jpg e trasformarla in scala di grigi

Creare l’immagine BW applicando un filtro di canny per l’estrazione degli edge

Applicare la trasformata di hough a BW: [H,T,R] = hough(BW);

Identificare 15 picchi in H applicando la funzione houghpeaks

Visualizzare H e plottare i picchi in rosso Estrarre i segmenti di linea con la funzione

lines = houghlines(BW,T,R,P,'FillGap',5,'MinLength',7);

Page 6: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Hough Transform

Page 7: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Thresholding Thresholding algorithm 

Search all the pixels f(i,j) of the image f. An image element g(i,j) of the segmented image is an object pixel if f(i,j) >=T, and is a background pixel otherwise.

Global Thresholding Esercizio 3

Caricare l’immagine text.jpg e trasformarla in scala di grigi Select an initial estimate for T. (A suggested initial value is the

midpoint between the minimum and maximun intensity values in the image.)

Segment the image using T. This will produce two groups of pixels, G1 consisting of all pixels with intensity values > T, and G2, consisting of pixels with values < T.

Compute the average intensity values x1 and x2 for the pixels in regions G1 and G2.

Compute a new threshod value: T=1/2(x1+x2) Repeat steps 2 through 4 until the difference in T in successive

iterations is smaller than a predifined parameter T0.

Page 8: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Thresholding

Page 9: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Thresholding Local thresholding

Esercizio 4 Caricare l’immagine MicroArraySlide e selezionarne una

porzione (imcrop) Applicare la sogliatura globale (graythresh) e locale

sull’immagine in scala di grigi

Page 10: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Region Based Segmentation Esercizio 5

Caricare l’immagine lungs.jpg e visualizzarla Identificare le coordinate di un seedpoint all’interno della

regione del polmone a sx Utilizzare la funzione regiongrow per segmentare il

polmone, assegnando una soglia opportuna

Page 11: Image Segmentation Francesca Pizzorni Ferrarese 05/05/2010.

Region Based Segmentation Esercizio 6

Copiare nella directory di matlab il file matitk.mexglx Caricare l’immagine penguin.jpg e trasformarla in scala di

grigi (f) Concatenare lungo z quattro immagini f Determinare l’immagine gradiente

GradMag = matitk('FGMRG',1.7,double(f)); Applicare la funzione di watershed