30.11.2012 Views

Thesis (PDF) - Signal & Image Processing Lab

Thesis (PDF) - Signal & Image Processing Lab

Thesis (PDF) - Signal & Image Processing Lab

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Algorithm 4 RAG image representation<br />

The gray-level image can be represented as a graph, where each node stands for the<br />

image flat zones and the edges connect all the neighboring nodes. The algorithm,<br />

that we have developed for graph building, involves the following stages:<br />

1: Initialize current label to zero. Mark all pixels as not processed. Start arbitrary<br />

from the image border. Insert all the pixels of the image border into fifo1 .<br />

2: if fifo1 is not empty then<br />

3: Get pixel current p1 from fifo1 .<br />

4: if this pixel was not processed yet then<br />

5: Increment emcurrent label, give this new current label to the current pixel<br />

current p1 and insert this pixel into the fifo2 . Go to 12.<br />

6: else<br />

7: Go to 2.<br />

8: end if<br />

9: else<br />

10: End algorithm.<br />

11: end if<br />

12: if fifo2 is not empty then<br />

13: Get pixel current p2 from fifo2 .<br />

14: else<br />

15: Go to 2.<br />

16: end if<br />

17: for every neighbor of the current pixel current p2 do<br />

18: if it was not processed yet then<br />

19: if it belongs to the same flat zone as current p2 then<br />

20: Insert it into fifo2 .<br />

21: else<br />

22: Insert it into fifo1 .<br />

23: end if<br />

24: else<br />

25: if it belongs to another flat zone then<br />

26: Then connect this flat zone in the graph to the current flat zone.<br />

27: Go to 12.<br />

28: end if<br />

29: end if<br />

30: end for<br />

115

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!