11

(This question relates to Extracting Binary Magnetic-Strip Card Data from raw WAV)

I am extracting the binary sequence from the magnetic strip on a credit card.

enter image description here

As you can see, the signal is degraded clearly in one place. also there is a minor degradation right on the left of the image.

Just using IIR (i.e. $X_{\rm out} = 0.9X_{\rm out_{last}} + 0.1X_{\rm in}$) smooths it, but the resulting signal is not mathematically smooth; if I differentiate the signal a couple of times the noise comes back with a vengeance:

enter image description here

My question is: can I remove the noise in such a way that the derivatives come out clean?

If so, how?

EDIT: Here is a close-up of some damaged waves:

enter image description here

EDIT(2): A couple of approaches I am considering:

  • Firstly I could make a taylor approximation of the signal either side of the damaged sector, and blend the approximations together.
  • Secondly I could FFT, remove high-frequency components and reverse FFT. I'm going to try that second approach now...
P i
  • 1,329
  • 11
  • 24
  • You're using a differentiator to pluck out high-frequency features in the signal (i.e. sharp transitions). The artifacts that you're trying to remove are similar, in that they are sharp transitions that will have similar highpass characteristics. They could be difficult to remove with a linear lowpass filter. A different approach (no pun intended) might be more appropriate. – Jason R Dec 01 '11 at 22:05
  • Sorry, my bad for posting misleading screenshots. I have included close-ups of sample damaged sections. – P i Dec 01 '11 at 23:18
  • A lowpass filter should work. The problem is that the frequencies of interest are changing as the person changes their swipe speed. – endolith Dec 02 '11 at 15:14
  • Correct. However, this base rate isn't going to change massively from one wave to the next. So I may be able to filter as I go (ie given the wavelength is k at a particular point, filter ahead in the signal an estimated 2 wavelengths, pick up the next blip, rinse and repeat). In this case, what would be a good filter? I need to preserve the derivatives... – P i Dec 04 '11 at 00:57
  • 1
    It seems that your signal is represented by the series of very distinctive "wavelets" describing the binary transitions. I think you should extract one distinctive wavelet and produce a "correlogram" by correlating the wavelet with the raw data. The positions of maximum similarity will be identified as strong peaks, while the waveform flaws will become only a minor noise. This method is widely used in seismic. Would you please provide a "time-value" series of your raw data in some spreadsheet-like form, so I can illustrate my idea. – mbaitoff Jan 09 '12 at 08:08
  • @mbaitoff, I am very keen to hear more on this approach, as I am still struggling with this problem. I had considered it but can't see a clear way to implement it. If you follow the first link in the question, it takes you to the original problem, and there I have supplied the raw .WAV. If you do answer, maybe it would make more sense to answer the original? – P i Jan 09 '12 at 16:52
  • @Pi: I followed your link in your original question, but it seems that the site you stored your files on has wiped them out. Also, I have no tools for operating on WAV files. I'd prefer a time-value text file. – mbaitoff Jan 09 '12 at 18:35
  • @mbaitoff, can you specify the format? Then I can easily assemble the data into that format. Internally my engine is storing the waveform as a raw dump of Float64's -- is that any good? (I am currently on #musicdsp on IRC's EFNet server as [Pi] if you use IRC ) – P i Jan 09 '12 at 19:08
  • @Pi: text format would be fine. Probably, the raw binary of 64-bit floats is too rough for me. Can you please provide the wave in textual format, one text line for each sample, and each sample are two textual floats - time at which the sample is taken, and the amplitude of the wave. Unfortunately, I'm not an IRC user, but you may try to contact me via ICQ two-zero-zero-eight-five-nine-zero-nine-nine. Please note that I'm UTC+6. – mbaitoff Jan 09 '12 at 19:39
  • @mbaitoff, I haven't touched IRC for years -- you don't use Skype do you? I am skyfish7. – P i Jan 09 '12 at 19:50
  • @Pi Have you looked into median filters? I happen to be in the process of implementing one now and could send it to you for you to try out. Barring that, I think I could fix that with wavelet transformations. – Spacey Feb 10 '12 at 22:09

1 Answers1

1

To remove high-frequency "noise" without removing sharp transitions, you might have to try some sort of non-linear filtering process.

A random example might be applying (cross fading to) a median filter only when the distance to the nearest N local maxima (or minima, and beyond some noise threshold) goes under some distance threshold (where this distance, N and the median filter width, are calibrated to the period of the suspected "noise").

hotpaw2
  • 35,346
  • 9
  • 47
  • 90