prajwalkr / SnapSudoku

Extract and solve Sudoku from an image
MIT License
250 stars 40 forks source link

An alternate version of sudoku.py to consider #20

Closed cclauss closed 8 years ago

cclauss commented 8 years ago
aulisius commented 8 years ago

Wonderful change :D . Helps me get started with the server implementation

prajwalkr commented 8 years ago

The modified sudoku.py gives the following error:


Traceback (most recent call last):
  File "sudoku.py", line 41, in <module>
    snap_sudoku(image_path=sys.argv[1])
  File "sudoku.py", line 31, in snap_sudoku
    s = SudokuStr(''.join(cell for cell in get_cells(image_path)))
  File "sudoku.py", line 31, in <genexpr>
    s = SudokuStr(''.join(cell for cell in get_cells(image_path)))
  File "sudoku.py", line 24, in get_cells
    x = net.feedforward(np.reshape(cell, (784, 1)))
  File "/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 224, in reshape
    return _wrapit(a, 'reshape', newshape, order=order)
  File "/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 48, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
ValueError: total size of new array must be unchanged

Do look into it @cclauss :smile:

cclauss commented 8 years ago

Did you retry this after the fix in https://github.com/prajwalkr/SnapSudoku/commit/a3b25dec58d644b259257060f12831a9677bf5cd ?

prajwalkr commented 8 years ago

No. Before fixing that issue.

cclauss commented 8 years ago

I think these two issues are related. Can you please sudoku_alt.py again now that the https://github.com/prajwalkr/SnapSudoku/commit/a3b25dec58d644b259257060f12831a9677bf5cd fix is in?

If that does NOT work, can you please put this line BEFORE line 24 in sudoku_alt.py and let me know what gets printed?

        print('len(cell): {}'.format(len(cell)))
prajwalkr commented 8 years ago

Fixed it myself! :smile: