Giter Site home page Giter Site logo

bubble-sheet-multiple-choice-scanner's Introduction

Bubble Sheet Multiple Choice Scanner

Bubble sheet multiple choice scanner example with OpenCV Java (opencv-3.4.0). Not ready for production usage yet.

Install

Download OpenCV from official site. Then add library to project and set VM options as following.

// native library path 

-Djava.library.path=/opencv/build/lib

Intellij

File > Project Structure (Ctrl + Alt + Shift + S) > Libraries > + (Alt + Insert) > Select OpenCV jar file 

Run/Debug Configuration -> Application -> VM options

Steps

  • Dilate source image for better recognition
  • Transform to Grayscale format
  • Threshold operation (for recognizing mask/conjuction with bitwise_and)
  • Blur filter
  • Canny edge algorithm
  • Adaptive Thresh (for find main wrapper rectangle & bubbles)
  • Recognize main wrapper rectangle according to hierarchy
  • Find bubbles with estimated ratio (~17/15.5)
  • Sort bubbles by coordinate points
  • Recognize which option is filled or empty with bitwise_and and countNonZero

Sources

Running

Run the "main" method of Main class.

    public static void main(String[] args) throws Exception {

        sout("...started");

    (1) Mat source = Imgcodecs.imread(getSource("sheet-1.jpg"));

        Scanner scanner = new Scanner(source, 20);
    (2) scanner.setLogging(true);
        scanner.scan();

        sout("...finished");
    }

(1) change source file name

(2) if logging is

  • enabled, you can see processing flow and some detailed logs.

  • disabled, you can see only output/result file.

Output (for sheet-2)

...started
*************************************
*************************************
answer is ....
*************************************
*************************************
1. A
2. D
3. B
4. EMPTY/INVALID
5. D
6. A
7. D
8. C
9. A
10. EMPTY/INVALID
11. B
12. A
13. D
14. EMPTY/INVALID
15. B
16. EMPTY/INVALID
17. EMPTY/INVALID
18. C
19. EMPTY/INVALID
20. D
...finished

alt text

bubble-sheet-multiple-choice-scanner's People

Contributors

m-cakir avatar yusucan avatar

Watchers

 avatar

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.