Log in

View Full Version : Advanced image filtering for isolating hardcoded subtitles


aax
10th December 2014, 22:50
Hi guys.
I'm extracting burned-in subtitles from some videos and have made a Photoshop action that does a pretty good job of isolating them from background when applied to screenshots (for easy OCR). So I was wondering if there is a way to get a similar effect with Avisynth because that would not only save me a step, but also improve automatic subtitle detection.

Here's what I do in Photoshop:

smart blur with both radius and threshold at 100%
high pass filter with radius around 4.2
new layer filled with black with blending set to "blend if" "underlying layer" is white (with white level set to around 160)
repeat smart blur on background layer some dozen times until I'm left with mostly clean letters (radius and threshold again at 100%)


https://dl.dropboxusercontent.com/u/11379791/KG/Forum/VideoSubFinder%20and%20ABBFR/Photoshop-highpass-01.png

https://dl.dropboxusercontent.com/u/11379791/KG/Forum/VideoSubFinder%20and%20ABBFR/Photoshop-highpass-02.png

johnmeyer
11th December 2014, 05:02
Unless you have some reason for wanting to do this with AVISynth, I would suggest an alternative approach.

I have used a free utility on several occasions. No need to mess with Photoshop or build anything yourself. Check it out:

Subrip (http://www.videohelp.com/tools/Subrip)

It reads the hard-coded subtitles, and OCRs them. You do have to "teach" the OCR, but after it has read a few dozen subtitles, it gets pretty smart and proceeds without much additional work on your part. The OCR works pretty well, and the timing is perfect.

[edit]BTW, nice job with the Photoshop extraction. Very cool that you figured out how to do that.

feisty2
11th December 2014, 05:12
Medianblur+mt_edge

fvisagie
11th December 2014, 09:58
Unless you have some reason for wanting to do this with AVISynth, I would suggest an alternative approach.

I have used a free utility on several occasions. No need to mess with Photoshop or build anything yourself. Check it out:

Subrip (http://www.videohelp.com/tools/Subrip)

It reads the hard-coded subtitles, and OCRs them. You do have to "teach" the OCR, but after it has read a few dozen subtitles, it gets pretty smart and proceeds without much additional work on your part. The OCR works pretty well, and the timing is perfect.

I can only second your suggestion for the excellent Subrip.

Remember to save your character matrix afterwards; with each subsequent video you'll need to enter fewer and fewer unrecognised characters.

Subrip also has nicely configurable tools for bulk correction of common errors (I/l, ''/" etc.) once scanning has been completed. Do check them out.

StainlessS
11th December 2014, 16:26
+1 on SubRip.
And Sub Edit is really very good for correcting some errors, syncing, Spell Checking + other stuff.
Sub Edit:http://forum.doom9.org/showthread.php?t=162721