Wednesday, March 2, 2016

Thinking outside the box

I'm currently enrolled in the degree program Georgia Tech offers through Udacity. It's called OMSCS. I'm taking Knowledge Based Artificial Intelligence:Cognitive Systems.

The primary project we are working on is Ravens Progressive Matrices.

I have tons of ideas, and approaches. I'll talk about one that I'm experimenting with (and have no idea if it'll work).

One thought that crossed my mind was what if i could think of these problems as a time relationship. Could I apply a Fast Fourier Transform (FFT)? Well I am giving it a shot.

First I took a line by line reading of the image, then layed it end to end. So in a way you have a all kinds of crazy waveform.

Next I used numpy to convert to the Power Domain using numpy.fft.fft(array).

I'm not much further than this, but I did try dividing A by B and A by C and graphing these ratios along with inverse FFT'ing.

I thought the graphs looked really neat. So I am going to leave a few here for your enjoyment.

Which by the way I should note, I have no idea what I'm doing here, it's experimentation and who knows if these graphs are even logical, but they're cool looking.

A/C
A/B


Original Images
C
A
B
Have a good one, I'll probably post more about this in the future.

Sunday, February 21, 2016

Converting a Scanned PDF to a text file

I have done a little fiddling and seem to be able to convert a PDF that is a scan of a book, to text format here is the approach in Ubuntu.

1. Put your .pdf in a folder, navigate to that folder in the command line.
2. Type the following:
pdftoppm -png [filename].pdf [prefix]
3. Next install gocr
sudo apt-get install gocr
4. Finally this command:
for i in *.png; do gocr -i $i -o $i.txt; done

You'll have a big list of .txt files.

Now you can concatenate all the files.

cat *.txt >> [new_file].txt

I won't claim that the text files are pretty at all, but you can take them and start to massage them so that you end up with a nice text file you can then use a speed reading app with.

If you build something that cleans these up, share it below.

Alternately if the PDF is not an image but a real PDF Text file, then a simple pdftotext command should work.