Search code examples
androidimage-processingshapesdigital-logic

Is it possible to scan Logical Gates from a handrawn image


I am thinking of a project for my university the teachers liked it but I am not sure if its even possible.

I am trying to make an andriod app. What I want to do is take a picture of a hand drawn logic circuit (having the AND, OR, NOT ... gates) recognize the gates, and make a circuit in the moblie and run it on all possible inputs

Example of logical circuit ( assume its hand drawn )

enter image description here

For this I will have to make a simulator on mobile, that I dont think is the hard part. The problem is how could recognize the gates from a picture.

I found out that theres a edge detection plugin in java but still I dont think its enought to recognize the gates. Please share any algorithm or any technique or tools that I can use to make this thing.

This is actually for my FYP, I cant find any good ideas and have to present this on thursday.


Solution

  • you will need to do some kind of object recognition the easiest way (conceptually) to identify gates is to simply do a correlation between the image and a bank of gates, or an "alphabet" You run the gate template over the entire image and look for the highest correlation, this means it matches the template closely and you likely found your gate of interest. here are a few interesting s0 posts

    Simple text reader (OCR) in Matlab

    MATLAB Optical character recognition - need help

    On it's own this could be a daunting task, but you can simplify the problem by adding constraints.

    1. For instance the user must draw on graph paper and they can only have one gate per grid. This ensures you won't have to check a large variety of sizes for each gate

    2. If you use graph paper with colored lines (like blue) and the user is only allowed to use a non-blue pen/pencil, you MAY be able to easily remove the grid when processing the image by filtering out the blue channel, and still have a clean image to process with.

    of course there are more advanced methods than correlation, but as I said before, conceptually, this model is very easy to understand. Hope that helps

    edit

    I just realized both my examples were in matlab, the important point here is the logic/process used, not the exact code.