You are given an image representing a scanned OMR answer sheet. Each image contains a…
- User
You are given an image representing a scanned OMR answer sheet. Each image contains a grid of circles, with each row representing one question and each column representing a possible answer (A, B, C, D). Some circles are filled to indicate the selected answer by the candidate.
Your task is to write a program that takes the image as input, along with an array containing the correct answers for each question and returns a score based on the number of correct answers. For each correct answer, score will be incremented by 1 point. Each question has only 1 correct answer.
The filled circles in the images can be either fully filled (360 degrees filled) or partially filled. A fully filled circle represents a definite answer, while a partially filled circle represents a probable answer. If a circle is filled more than 75% (270 degrees filled) of the area, it should be considered as a definite answer. Sample OMR images
For the below image, when evaluating with the expected answer as D A D C, the score is evaluated as 4
image
For the below image, where partial circles are filled, when evaluating with expected answer as C D D D, the score is evaluated as 3
image
Note
Few things to keep in mind while evaluating the score
A filled circle is considered definite answer when 75% of the circle area is filled, which means 270 degress or more must be filled to consider it as a definite answer.
If a candidate has marked more than one circle as definite answer for a question, then even if the definite answers contains the correct answer, no score will be provided for that question.
Input Format Guidelines
First line in the standard input represents the image to be used eg. omr_sheet_1.png Second line in the standard input represents the correct answer for the omr sheet, separated by a space
Sample Input
omr_sheet_1.png D A D C Reading the Input
You can read the input as standard input.
To load the image, you can load it as following: Python
//read from standard input filename = input() // get file if os.path.isfile(filename): Open the file
with open(filename, 'r') as file: ... Java
import java.io.File; ... // read from standard input Scanner scanner = new Scanner(System.in); String query = scanner.nextLine(); // Get the image file File file = new File("omr_sheet_1.png");
Constraints Image constraints
All Image dimensions are 500 x 500 2 color present only, black & white. Every image has 4 Questions with 4 options. Every Question has only 1 correct question.
Output Format Guidelines
Please output only the score in standard output
you can use only these libraries requests[security]@2.22.0, beautifulsoup4@4.8.1, pycrypto@2.6.1, cryptography@2.8, python-dateutil@2.8.1, urllib3@1.25.7, pyyaml@5.2, numpy@1.16.5, scipy@1.2.2, sympy@1.4, scikit-learn@0.20.4, nltk@3.4.5, pandas@0.24.2, statsmodels@0.10.2
- Assistant