Git Product home page Git Product logo

kayak's Introduction

The Kayak puzzle

So I saw this funny word search on the internet that was composed only of letters K, A and Y. The point of the word search was to find the word KAYAK. Seemingly impossible and the author disclosed that the word KAYAK appears in the glyphs matrix only once.

After I spent a couple of minutes solving the puzzle I figured it would be interesting to write a program to solve the puzzle for me, since I've never done any OCR before, and wanted to try it.

An image of the KAYAK word search

How did I proceed

The very first step was to remove the title and help text from the word search so it could be processed by the program without distractions. I've done this using Mac OS X's Preview.app. Here's the image after cropping:

The cropped image

Then, using OpenCV I separated individual glyphs into a matrix, storing each glyph on index according to its possition in the glyphs matrix on the image.

After that, I initialized Artificial Neural Network with following topology: 9 inputs, 5 neurons in one hidden layer and one output. I resized each glyph into 3x3 pixel matrix, each pixel corresponding to one input and selected 3 glyphs for training the ANN.

After the ANN was trained I could predict each individual glyph and get ASCII code instead. Once predicted, it was relatively straightforward to search for the string. Here's an image of the output image after search has been done:

A matched KAYAK word

Implementation

The implementation can be seen in the main.cpp file. The code is messy and not very clear but hopefully you'll find it useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.