Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support for detecting tick marks or cross marks #167

Open
Udayraj123 opened this issue Feb 17, 2024 · 9 comments
Open

[Feature] Support for detecting tick marks or cross marks #167

Udayraj123 opened this issue Feb 17, 2024 · 9 comments

Comments

@Udayraj123
Copy link
Owner

Udayraj123 commented Feb 17, 2024

Is your feature request related to a problem? Please describe.
It'll be good to have support for tick marks/cross marks instead of just fully circled bubbles.

Describe the solution you'd like

  • Traverse each bubble point just like in the current algorithm
  • Instead of calculating the mean pixel value for a bubble, use a different algorithm to accurately detect a cross or a tick mark (open to ideas)
  • The algorithm should be able to differentiate between a slightly shifted bubble boundary(checkbox walls) vs a tick mark (no false positives)
image
  • Return a fixed value for that detected bubble so that it works with existing algorithm too.
for pt in field_block_bubbles:
    # shifted
    x, y = (pt.x + field_block.shift, pt.y)
    rect = [y, y + box_h, x, x + box_w]
    q_strip_vals.append(
        # cv2.mean(img[rect[0] : rect[1], rect[2] : rect[3]])[0]
        detectCross(img, rect) ? 0 : 255
    )

Additional context

@Udayraj123 Udayraj123 added enhancement New feature or request good first issue Good for newcomers Discussion intermediate labels Feb 17, 2024
@Udayraj123 Udayraj123 changed the title [Feature] Support for tick marks instead of fully circled bubbles [Feature] Support for tick marks or cross marks Feb 17, 2024
@alt-shreya
Copy link

I'd like to give this a shot!

@Udayraj123
Copy link
Owner Author

Hello @alt-shreya, feel free to propose a basic solution/approach. Then I will assign the issue to you :)
You may also discuss it on discord if needed

@alt-shreya
Copy link

@Udayraj123 I went through the resources you had linked, and found the StackOverflow discussion very interesting.
Building upon the approach highlighted by nathancy, a cross could be detected in the same way that an X is detected in handwriting recognition (2 diagonal lines of similar length and an intersection point), and a starting point to detecting tick marks could be to detect two lines inside the contour, in which the length of one line is shorter than the other

@Udayraj123
Copy link
Owner Author

Hey @alt-shreya, thanks for taking forward the discussion.

cross could be detected in the same way that an X is detected in handwriting recognition
Are you thinking of exploring using an ML algorithm for this?

to detect two lines inside the contour, in which the length of one line is shorter than the other
Okay, but anything on distinguishing it from bubble boundary? If the box gets shifted left or right a little bit, the contour approach will probably get disturbed. Can you try something on the shape approximation as done in the Stackoverflow discussion?

@alt-shreya
Copy link

@Udayraj123

Are you thinking of exploring using an ML algorithm for this?

yes

If the box gets shifted left or right a little bit, the contour approach will probably get disturbed.

Could you give me an example of when it might shift?

@Udayraj123
Copy link
Owner Author

Udayraj123 commented Feb 21, 2024

Could you give me an example of when it might shift?

I don't have images with tick marks handy, but I think the following will suffice.
So the shifting problem exists for any OMR sheets(even without tick marks). Usually happens in the bottom and bottom-right sections due to scanning/printing skews.

Here's a few examples for the general shifting problem -
From template alignment, notice the boxes are slightly shifted around -

image

Try to imagine tick marks instead of the bubbles in above image. For filled bubbles we use the mean value for the whole box which usually works, so we ignore any slight shifts in the image in current approach.

But this mean value approach also fails sometimes for in cases like this (false positive) -
image

@Udayraj123
Copy link
Owner Author

Here's a sample you can try this out with(will need to create a small template.json) -

Original Shifted
image image

I've manually added a slight shift in the images.

Note that you will need a larger bubbleDimension in the template since the tick marks are overflowing the expected box.
Let me know if you need help with creating the initial template.json

@Udayraj123 Udayraj123 changed the title [Feature] Support for tick marks or cross marks [Feature] Support for detecting tick marks or cross marks Apr 17, 2024
@chirag4862
Copy link

I would Like to work on the solution for this if it is still open and not being worked on already

@Udayraj123
Copy link
Owner Author

Hey @chirag4862, this issue is labelled as intermediate and can be picked up after getting familiar with OMRChecker through any other issues first as this will take some time Let's get you familiar with submitting your first sample!

@Udayraj123 Udayraj123 removed the good first issue Good for newcomers label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants