Skip to content

Sensible error when the image does not contain a sudoku. #1

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

Open
EduardBenet opened this issue Feb 11, 2020 · 0 comments
Open

Sensible error when the image does not contain a sudoku. #1

EduardBenet opened this issue Feb 11, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@EduardBenet
Copy link

If the image does not contain a sudoku at all, the code:

[solution, outputs] = solver.process(exampleImage);

errors as follows:

Index in position 1 is invalid. Array indices must be positive integers or logical values.

Error in tabular/subsrefBraces (line 35)
    b = b(rowIndices,:); % without using reshape, may not have one

Error in tabular/numArgumentsFromSubscript (line 21)
        x = t.subsrefBraces(s(1));

Error in sudoku.findPrimaryRegion (line 19)
    filledRegion = imerode(regions{end, 3}{1}, ones(3));

Error in sudoku.PuzzleSolver/findPuzzle (line 82)
            mask = sudoku.findPrimaryRegion(thresholdedImage);

Error in sudoku.PuzzleSolver/process (line 62)
            [mask, findSteps] = obj.findPuzzle(im);

It would be great if we could make it error in a more sensible way. So far, in my own repo I added the following in src/sudoku/+sudoku/findPrimaryRegions

if isempty(regions)
     error('A sudoku could not be found on the image')
end
@justinpinkney justinpinkney added the enhancement New feature or request label Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants