I am making a character recognition library using contour analysis. Contours are sequencies of complex numbers X + j*Y (in fact in contour analysis they are defined as ΔX + j*ΔY, but for smoothing I use the repr without delta), describing displacements of points relative to each other. Looking at FFT I saw a lot of ringing at high frequencies, even though the contours end in the same point they begin in, they are periodic. I had a guess that it may be because of sharp angles in contours, where complex argument changes rapidly. (in fact it haven't helped, the ringing is present even in 0 and O outlines, wich have no sharp angles, but I guess such smoothing may still be beneficial, because it would make the func analytical and because it would unify shapes of the same glyphs in different fonts, where one font has sharp angles and another one doesn't). I have tried gaussian lowpass filter of the original signal with adaptive sigma (scanned sigma in wide range, for each sigma computed L2 loss between original shape and smoothed one, detected the knee on log plot (the dependence can be modelled as a + b*exp(-k*(sigma - sigma0)), so the log plot looks like 2 lines with an angle between them, when sigma is inadequate, the contour is completely disrupted and is open, and the adequate sigma may be different for different contours by 2 orders of magnitude) and selected the point on knee, for most of characters it gave good enough results, but not for digits, especially for 9 where lower part is sharp, which requires large sigmas about 150, when most of glyphs are OK with about 5-30). I don't like the lowpass approach because it is applied for all angles equally (so letting more high freqs for the lower part of 9 means we let them for the rest of the contour), but it may be beneficial to filter each angle individually. I have also tried smoothing of argument and modulus with absolutely garbage results. I have also tried some smoothing with wavelets, but again, dwt gives garbage results, maybe should try with mexican hat.

What would you advice me? Are there any established method for such kind of filtering?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.