Page 1 of 1

Circle detection | Radio button detection | OMR

Posted: 2018-07-30T12:17:20-07:00
by legend
Hi

I want to detect Radio button selection option in the image like below. How can I do that? Thanks!

Image

Image

Image

Re: Circle detection | Radio button detection | OMR

Posted: 2018-07-30T13:02:50-07:00
by legend
please do the needful

Re: Circle detection | Radio button detection | OMR

Posted: 2018-08-01T13:57:16-07:00
by legend
It seems no one read this Topic :(

Re: Circle detection | Radio button detection | OMR

Posted: 2018-08-01T14:58:31-07:00
by snibgo
Your question is too vague. Do images always have three options? Do you need to detect them all? Are they always in the same position? If so, just examine a pixel and test for black or white. If the positions vary, the task is messy. You might first search for the semi-circles.

Re: Circle detection | Radio button detection | OMR

Posted: 2018-08-01T15:02:39-07:00
by fmw42
I would suggest you create a template with full circle (and possible the word Option in the same font), then use compare with -subimage-search to locate a circle. You can test two templates; one with the dot in the center and one without, if you need to located each option. As snibgo has said your question is vague and we do not know exactly what you are trying to do.

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown

Re: Circle detection | Radio button detection | OMR

Posted: 2018-08-03T08:31:22-07:00
by legend
IM version: latest version
platform : Command Line or .NET
------------------------------------------------------
1. Do images always have three options? --> Yes
2. Do you need to detect them all? --> Yes
3. Are they always in the same position? --> No, it can be anywhere in image

How to find the semi-circles. ?, Please guide me.

Thank You

Re: Circle detection | Radio button detection | OMR

Posted: 2018-08-03T08:57:38-07:00
by fmw42
Latest image does not give enough information, especially at some later time when this post is older. Best to respond with 6.9.10.8 or 7.0.8.8 if that is what you are really using.

Your platform is either Linux (some specified type), Windows version, Mac OSX version.

You should be testing for full circles, since scans do not always produce the same shape.

Have you read:

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

Re: Circle detection | Radio button detection | OMR

Posted: 2018-08-03T14:35:37-07:00
by snibgo
There are many ways of doing this. For example:

1. Make a sample selected.png and nosel.png:

Code: Select all

%IMG7%magick ^
  rdSNzgq.png ^
  +write x.png ^
  ( +clone ^
    -crop 20x18+541+25 +repage ^
    +write selected.png ^
    +delete ^
  ) ^
  -crop 21x21+16+24 +repage ^
  nosel.png
2. Find the first reasonable match in the first image:

Code: Select all

%IMG7%magick compare ^
  -metric RMSE -subimage-search ^
  tVrbBlZ.jpg ^
  selected.png ^
  -dissimilarity-threshold 1 ^
  -similarity-threshold 0 ^
  NULL:
The result is:

Code: Select all

22215.9 (0.338993) @ 356,42
3. Crop that rectangle out into f1.png, and over-paint it white, writing to tmp.png.

Code: Select all

%IMG7%magick ^
  tVrbBlZ.jpg ^
  -fill White ^
  ( +clone ^
    -crop 20x18+356+42 +repage ^
    +write f1.png ^
    +delete ^
  ) ^
  -draw "rectangle 356,42 376,60" ^
  tmp.png
4. Is f1.png more like selected.png, or more like nosel.png?

Code: Select all

magick compare -metric RMSE f1.png selected.png NULL:
22215.9 (0.338993)

magick compare -metric RMSE f1.png nosel.png NULL:
38363.3 (0.585386)
The score is lower for selected.png, so f1.png is "selected".

Repeat from step 2, using tmp.png as the input, until no more matches are found (ie the score is low).