Thursday, November 12, 2015

Thursday: Totally the kind of thing grown ups do.

Me, opening up the door to the elevator lobby: ""
Dog, standing there, pulling on her leash from behind the corner: ""
Me: "Oh! Hello, doggy!"
Dog: ""
Dog's owner: "Yeah, she's in a hurry today."

Whatever.  It was a surprise dog.  That happens.

Part 2: Solving problems with Fourier transforms because Fourier transforms are fun.

The other thing that happened today is Julie mentioned something about how to measure the orientation of text.  I found a few references online, and then while eating lunch, came to the conclusion that this is something that can probably be done with Fourier transforms, and that the algorithm I had in my head was effectively a Fourier method done on a irregularly binned version of the image.

The idea behind my algorithm is that text is basically a long sequence of characters, and those characters are typeset into rows that are non-overlapping.  This means that a block of text is vaguely defined as a periodic sequence of lines.  If you need to know the orientation of text (with the complication that you can't distinguish between mirror reflections and 180-degree rotations), then you should look for the angle of the tilt of linear features in the Fourier power spectrum.

So, since I have access to programs that can both rotate things and calculate Fourier power spectra, I gave it a try.

Sequence of text images and zero-frequency-in-center power spectra.

Yep, that looks like it works correctly.  Looking at the top left, the linear features in the spectrum are aligned vertically.  This is due to the fact that the lines of text are largely unconstrained in their length, but they are always close to the same distance apart.  Skipping the zero-x-frequency line, the lines to the right (higher frequency) correspond to increasingly closer lines.  These are separated by some f_spacing value, which is directly related to the font size/line separation.

Great, but what happens if there's an additional term to the distortion?  What if it's not just a rotation but some kind of scaling issue.  Gimp has a convenient "stretch the image based on a curve you can shift around," so I made a kind of "Star Wars opening credits" thing.  Does the Fourier solution still work?


Yep.  Since lines are no longer cleanly confined to a simple box shape, the power spectrum drops off much faster in the "along lines" direction.  Still, the axis corresponding to the "text page up/down" (which is the zero-frequency in "along text lines") is still much stronger, and the f_spacing peaks are still visible.

Part 3: Fuck, really?

Earlier today, I saw this buzzfeed article, and was calmly thinking, "yeah, I know, I've been playing it for months."  Then I got to #10 and thought, "wait, there's an English version?"

It turns out that last month when they had the update that added the train and other things that I've already bought, they added an English option in the menu.  I assume that since I've been playing for so long in Japanese, they didn't bother pointing this out to me.

The most important thing about this is that it means I don't have to make up names for the cats because I'm too lazy to translate them all.


So's he's not "Super Pretentious Cat Prince"?

Conductor Whiskers is pretty good.  "Train Cat" is probably a bit simple.  "Fucking Alpine Cat" is better than Bob, though.

And Sassy Fran is far better than "Maid Cat."

Part 4: Links.

No comments:

Post a Comment