Marcin Pazio, dr Krzysztof Cisowski Application of colour image segmentation for localisation and extraction text from imagesSesja: Kształcenie w dziedzinie elektroniki i telekomunikacji.Politechnika Gdańska
Pełen tekst
(2) www.pwt.et.put.poznan.pl. 4. IMAGE SEGMENTATION The goal of image segmentation is to split a image into a homogeneous regions, called segments. Some parameters of segments (location, size, colour) will allow to create sets of segments, that may be a text. Segmentation algorithm is an iterative region growing algorithm with automatic seed pixels determination. A. Searching for the seed pixes Seed pixels are pixels where region growing starts. The L*a*b* parameters of seed pixels are pointed in every iteration of the segmentation, using pixels not included into any segment. First, the image colours are indexed, and pixels with each index are counted: pixel: record of L:lightness a:a_component b:b_component end; Image: array [1..width,1..height] of pixel; PixelData: record of color: pixel counter: number of pixels end; IndexTable: Array[1..MaxIndex] of PixelData begin for x:=1 to image_width do for y:=1 to image_height do if image_pixel[x,y] not included into segment then begin ActualIndex:=1; z:=1; IndexedColor:=false; repeat if IndexTable[z].PixelData.color=image[x,y] then begin //color already indexed inc(IndexTable[z].PixelData.counter); IndexedColor:=true; end increment(z); until (z>ActualIndex) or (indexedcolor=true); if indexedcolor=false then //color not yet indexed begin Inc( IndexTable[ActualIndex].PixelData.counter); IndexTable[ActualIndex].PixelData.color:=image[x,y]; Inc(ActualIndex); end; end;. Next, the algotithm seeks MaxIndex maximizing the IndexTable[MaxIndex].PixelData.counter value. Color given by index table at position MaxIndex: IndexTable[ActualIndex].PixelData.color is the color of seed pixel (or pixels). B. Region Growing Algorithm. pixels, i.e. pixels of color obtained in past step, and iteratively adds pixels to segment. begin for x:=1 to width do for y:=1 to height do if Image[x,y]=seed_pixel_color then begin set new segment number p; GrowUpSegment(x,y); end; end;. Recursive GrowUpSegment() procedure first checks if region growth criterion K() is satisfied for current pixel and then check all 4-neighborhood pixels: GrowUpSegment(x,y); begin if Pixel(x,y) not in any segment and K(Image(x,y),seed_pixel_color) then begin Include Pixel(x,y) to segment p; GrowUpSegment(x-1,y); GrowUpSegment(x+1,y); GrowUpSegment(x,y-1); GrowUpSegment(x,y+1); end. K(p1, p2) is criterion of region growth (3).. {. K s p1, p2 =. true :∥ab p −ab p ∥K false :∥ab p −ab p ∥≥ K 1. 2. 1. 2. }. 3) where : ∥ab p −ab p ∥: euclidean distance of pixels p1 and p2 in L*a*b* space K : constant value 1. 2. Finding of the seed pixels followed by segment growth is executed iteratively until all pixels are included in the segments. L*a*b* parameters of the segment are calculated as a simply average of corresponding colour and luminance values of all pixels included in the segment.. 5. TEXT LOCALIZATION Text localization is based on comparison of segments characteristics in segmented image using several intuitive rules [3]. Usage of these rules for written information is condition of its readability. This rules utilize geometrical and colour parameters of the segments. Algorithm creates sets of segments that answers to the following conditions: 1. Segments should have similar colour ∣L S −L S ∣∣a S −aS ∣∣b S −bS ∣c 4 4) where L , a , b S , L , a , bS : color components of tested segments c4 : constant value k. k. l. k. l. k. l. l. 2. Segments should have similar height. The criterion of including pixels to the segment are based on distance of seed pixel to its 4-neighborhood pixels [2] in the L*a*b* space. Process starts at the seed. PWT 2005 - POZNAŃ 8-9 GRUDNIA 2005. 2/4.
(3) www.pwt.et.put.poznan.pl. c 1. HS c 2 HS k. (5). l. where H S , H S : heights (in pixels) of tested segments c1, c2 : constants k. l. 3. Segments corresponding to the letters should be positioned on a vertical lines ∣Y S −Y S∣ (6) c3 Hi where Y S , Y S : distance of the lowest pixel in the segment to the bottom of the image H i : image height c3 : constant value k. k. l. l. 4. Gap between segments in set of segments creating text should not be to wide. ∣X S − X S ∣ k. Sh. l. c 3. (7). where Y S , Y S : distance leftmost segment to the rightmost segment in set S h : number of segments in set c 4 : constant value k. l. Above rules are used in algorithm creating sets of segments that may be the text :. for S n :=S0 to S max ℕ n :={S n } p:=n1newline repeat if ∃ K k S z , S p then ℕn :=ℕ n∪{S p } {S z}∈ℕn. (8). p := p1 until p=max where max : maximum segment number ℕ n : set of segments creating text S n : n-th segment Text localizing algorithm treats each image segment as a seed set and compares it to the rest of the image segments. Kk is criterion of including segment to the set. It is satisfied, when each criterion (4..7) are true.. 6. POST-PROCESSING Described image segmentation algorithm uses global image data for segmentation. Such approach gives short processing times, but segments corresponding to letters are distorted. The main reason for these troubles is the. PWT 2005 - POZNAŃ 8-9 GRUDNIA 2005. way digital image is created. As described in section II, colour data used for segment creation (3) are blurred. Therefore segmented image requires post-processing. Segments created by segmentation procedure are de fined good enough to be analyzed by text localizing algo rithm. Information about segments that may be a text can be used for local enhancement of segmentation results. Such approach can speed up process, as it allows to process only small portions of image. create_set_bounding_rectangle; letter_color:= average_color _of_pixels_creating_set_elements; background_color:=average_color _of_rest_of_pixels_within _bounding_rectangle; for x:=0 to bounding_rectangle_width do for y:=0 to bounding_rectangle_height do begin distance_to_letter:=LabDistance( bounding_rectangle_pixel(x,y), letter_Color); distance_to_background( bounding_rectangle_pixel(x,y), background_Color); if distance_to_letter>distance_to_background then output_image_pixel(x,y):=0 else output_image_pixel(x,y):=1 end;. Function LabDistance(pixel1,pixel2) returns distance in L*a*b* space from pixel1 to pixel2 colour. As the result of post-processing procedure the binary image output_image is given.. 7. EXPERIMENTAL RESULTS Image shot by digital camera was used as the source image. A. Source Image The picture was recorded in TIFF format, in order to avoid a compression artifacts. Photograph was taken on the street, at the average lighting conditions. Image is shown on (Fig. 2). B. Segmentation and text localizing results Image segmentation and text localizing results are shown on (Fig. 3). The sets of segments selected as text are marked with the rectangular boxes. Segments contain ing less than 60 pixels were not analyzed, and sets containing more than 3 segments are treated as a text. Such limits speed up process and reduce number of false alarms.. 3/4.
(4) www.pwt.et.put.poznan.pl. C. Post-processing Results of post-processing (Fig. 4) shows the shape of segments treated as the letters of a text.. For better illustration recognized text is located over the source image. False alarms were rejected manually.. 8. CONCLUSIONS Described method is the way for the fast text localization. It takes about 7 seconds on PIV/2,8Ghz computer for shown illustration sized 598x506 pixels to produce presented results. Further image processing should recognize and eliminate distortions of image created by optical reproduction and perspective. Some of these methods are described in [4]. False recognitions can be quickly eliminated by OCR, as the only small portions of source image are checked by OCR. However, being limited to finding at least 3-letter long words, it can be first step in more complex approaches of finding single letters or numbers [5].. REFERENCES [1]. Adobe Photoshop 4.0 Software Development Kit, Adobe Systems Inc., 1996.. [2]. J. Pitas, “Digital Image Processing Algorithms”, Pretience Hall, 1993.. [3]. S.G. Wheeler, G.S. Wheeler, “Typografia Komputerowa”, Exit, Warsaw.. [4]. R. Cattoni, T. Coianiz, S. Messelodi, C.M. Modena, “Geometric Layout Analysis Techniques for Document Image Understanding: a Review”, ITCIRST Technical Report, Trento, Italy, 1998.. [5]. J. Lebiedź, “Określenie Podobieństwa Kształtu Obiektu Do Litery Lub Cyfry”, II KKTI, Gdańsk, 2004.. Fig. 2. Source image from digital camera.. Photography by Piotr Zabłocki. Fig. 3 Segmented image with marked text boxes.. Fig. 4. Image with pasted post-processed text regions.. PWT 2005 - POZNAŃ 8-9 GRUDNIA 2005. 4/4.
(5)
Powiązane dokumenty
X nie ma wtedy interpretacji czasu oczekiwania na m-ty sukces.. Rozkład ujemny
Oberlin stated the following conjecture concerning uniform estimates for oscillatory integrals with poly- nomial
The set of multiples M (A) of any left compressed set A (in the sense of Definition 2) possesses asymptotic density.. We conjecture this even for left compressed sets in the sense
This upper bound of ours for π(x, y) is somewhat less precise than the upper bound in Corollary 2 of Hildebrand and Tenenbaum [12], but our result is more explicit, has an easier
From the one-to-one correspondence between conjugacy classes of S n and ordinary partitions of n, this amounts to the question whether or not almost all pairs of ordinary partitions
By the reasoning in the proofs of Theo- rems 5 and 6, the other sets in the theorem are finite unions of contractions of T.. By reasoning similar to that in Theorem 3, the sets can
We can apply the proof of Theorem 5.10 to obtain an example of a tower contained in an F σ filter for which the random algebra adds an infinite pseudo-intersection..
[r]