2

I had the idea to make a rows and columns detection of a table, a Likert scale table detection. for more details see the image in this link. http://img.docstoccdn.com/thumb/orig/42750583.png

The problem is:
I want to enter the values ​​that are within the cell into an 2d array in my program. value of 1 if there are signs (any kind), and 0 if it is empty.

note:
first row and first column that should be the place for header and questions still get a 1, I can skip the first row and column in the process later.

to do that, I need to know:

  1. whether there is a sign in the cell or not
  2. find out what rows and columns so I can put in my 2d array properly. (1 if any, 0 if not)

I am new to OpenCV, and I only know how to detect the the existence of border (some pre-processing, contour detection, and searching approxPolyDP). i have read this post How to remove convexity defects in a Sudoku square? but still, i don't know what i have to do..

Community
  • 1
  • 1

2 Answers2

1

When the input images are similar to your example image then for convenience I would not use the Hough transform.

In the following I propose a simple method to detect the lines. This approach only works if your input image is similar to the example image, i.e., the lines are parallel to the image borders.

  1. Count the black pixels for each row and the black pixels for each column (or with an intensity > 0.5)
  2. Search for each row and each column that contains at least a certain number of black pixels. Therefore, use a threshold t1.
  3. Take the following condition into account. The distance between two rows (and two columns) should be at least t2.

Thereafter, you should have the single rows and the single columns. There is only one problem left (if it is a problem for you). The lines, which are representing the columns are not continuous. Therefore, you can detect the gaps between the tables by measuring the lengths of the column lines.

When the cells are detected you can measure the pixels inside each cell and determine the correct cell.

who9vy
  • 1,091
  • 9
  • 19
  • i'm sorry, i still don't get it :( in point 1, what is the purpose i should count the black pixel in each row and column. in point number 2, is your purpose is to detect any sign in the cell (cheklist, or dot, or something that wrote by respondent) by searching whether there is a certain number of black pixel inside it? – littledeveloper Oct 22 '13 at 14:15
0

i think i found a good reference here, http://blog.ayoungprogrammer.com/2013/03/tutorial-creating-multiple-choice.html

it's about multiple choice detection, and i think his case is about the same like mine, he must detect whether the answer is in column A, B, C, D, or E..