Mercurial > ift6266
comparison writeup/techreport.tex @ 428:9fcd0215b8d5
Added text for ratures filter
author | fsavard |
---|---|
date | Sat, 01 May 2010 14:27:56 -0400 |
parents | ace489930918 |
children | bfa349f567e8 e2fd928a7de0 |
comparison
equal
deleted
inserted
replaced
427:ace489930918 | 428:9fcd0215b8d5 |
---|---|
70 successful algorithms were proposed to overcome some of these | 70 successful algorithms were proposed to overcome some of these |
71 difficulties. | 71 difficulties. |
72 | 72 |
73 \section{Perturbation and Transformation of Character Images} | 73 \section{Perturbation and Transformation of Character Images} |
74 This section describes the different transformations we used to generate data, in their order. | 74 This section describes the different transformations we used to generate data, in their order. |
75 We can differentiate two important parts in the pipeline. The first one, from slant to pinch, perform transformations | 75 We can differentiate two important parts in the pipeline. The first one, from slant to pinch, performs transformations |
76 of the character. The second part, from blur to contrast, add noise to the image. | 76 of the character. The second part, from blur to contrast, adds noise to the image. |
77 | 77 |
78 \subsection{Adding Slant} | 78 \subsection{Adding Slant} |
79 In order to mimic a slant effect, we simply shift each row of the image proportionnaly to its height: $shift = round(slant \times height)$. | 79 In order to mimic a slant effect, we simply shift each row of the image proportionnaly to its height: $shift = round(slant \times height)$. |
80 We round the shift in order to have a discret displacement. We do not use a filter to smooth the result in order to save computing time | 80 We round the shift in order to have a discret displacement. We do not use a filter to smooth the result in order to save computing time |
81 and also because latter transformations have similar effects. | 81 and also because latter transformations have similar effects. |
190 We initialize to zero a mask matrix of the image size. For each selected pixel we add to the mask the averaging window centered to it. | 190 We initialize to zero a mask matrix of the image size. For each selected pixel we add to the mask the averaging window centered to it. |
191 The final image is computed from the following element-wise operation: $\frac{image + filtered_image \times mask}{mask+1}$. | 191 The final image is computed from the following element-wise operation: $\frac{image + filtered_image \times mask}{mask+1}$. |
192 | 192 |
193 This filter has a probability of not being applied, at all, of 75\%. | 193 This filter has a probability of not being applied, at all, of 75\%. |
194 | 194 |
195 \subsection{"Ratures"} | |
196 | |
197 The ratures ("scratches") filter places line-like white patches on the image. The lines are in fact heavily transformed images of the digit "1" (one), chosen at random among five thousands such start images of this digit. | |
198 | |
199 Once the image is selected, the transformation begins by finding the first $top$, $bottom$, $right$ and $left$ non-zero pixels in the image. It is then cropped to the region thus delimited, then this cropped version is expanded to 32x32 again. It is then rotated by a random angle having a Gaussian distribution of mean 90 and standard deviation $100 \times complexity$ (in degrees). The rotation is done with bicubic interpolation. | |
200 | |
201 The rotated image is then resized to 50x50, with anti-aliasing. In that image, we crop the image again by selecting a region delimited horizontally to $left$ to $left+32$ and vertically by $top$ to $top+32$. | |
202 | |
203 Once this is done, two passes of a greyscale morphological erosion filter are applied. Put briefly, this erosion filter reduces the width of the line by a certain $smoothing$ amount. For small complexities (< 0.5), $smoothing$ is 6, so the line is very small. For complexities ranging from 0.25 to 0.5, $smoothing$ is 5. It is 4 for complexities 0.5 to 0.75, and 3 for higher complexities. | |
204 | |
205 To compensate for border effects, the image is then cropped to 28x28 by removing two pixels everywhere on the borders, then expanded to 32x32 again. The pixel values are then linearly expanded such that the minimum value is 0 and the maximal one is 1. Then, 50\% of the time, the image is vertically flipped. | |
206 | |
207 This filter is only applied only 15\% of the time. When it is applied, 50\% of the time, only one patch image is generated and applied. In 30\% of cases, two patches are generated, and otherwise three patches are generated. The patch is applied by taking the maximal value on any given patch or the original image, for each of the 32x32 pixel locations. | |
195 | 208 |
196 \subsection{Color and Contrast Changes} | 209 \subsection{Color and Contrast Changes} |
197 | 210 |
198 This filter changes the constrast and may invert the image polarity (white on black to black on white). The contrast $C$ is defined here as the difference | 211 This filter changes the constrast and may invert the image polarity (white on black to black on white). The contrast $C$ is defined here as the difference |
199 between the maximum and the minimum pixel value of the image. A contrast value is sampled uniformly between $1$ and $1-0.85 \times complexity$ | 212 between the maximum and the minimum pixel value of the image. A contrast value is sampled uniformly between $1$ and $1-0.85 \times complexity$ |