Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to remove convexity defects in a Sudoku square?
    primarykey
    data
    text
    <p>I was doing a fun project: Solving a Sudoku from an input image using OpenCV (as in Google goggles etc). And I have completed the task, but at the end I found a little problem for which I came here.</p> <p>I did the programming using Python API of OpenCV 2.3.1.</p> <p>Below is what I did :</p> <ol> <li>Read the image</li> <li>Find the contours </li> <li>Select the one with maximum area, ( and also somewhat equivalent to square).</li> <li><p>Find the corner points.</p> <p>e.g. given below:</p> <p><img src="https://i.stack.imgur.com/h1yKg.png" alt="enter image description here"></p> <p>(<strong>Notice here that the green line correctly coincides with the true boundary of the Sudoku, so the Sudoku can be correctly warped</strong>. Check next image)</p></li> <li><p>warp the image to a perfect square</p> <p>eg image:</p> <p><img src="https://i.stack.imgur.com/i4D9o.png" alt="enter image description here"></p></li> <li><p>Perform OCR ( for which I used the method I have given in <a href="https://stackoverflow.com/questions/9413216/simple-digit-recognition-ocr-in-opencv-python">Simple Digit Recognition OCR in OpenCV-Python</a> )</p></li> </ol> <p>And the method worked well.</p> <p><strong>Problem:</strong></p> <p>Check out <a href="http://web.archive.org/web/20140601100441/http://davemark.com/images/sudoku.jpg" rel="noreferrer">this image.</a></p> <p>Performing the step 4 on this image gives the result below:</p> <p><img src="https://i.stack.imgur.com/YTiOC.jpg" alt="enter image description here"></p> <p>The red line drawn is the original contour which is the true outline of sudoku boundary.</p> <p>The green line drawn is approximated contour which will be the outline of warped image.</p> <p>Which of course, there is difference between green line and red line at the top edge of sudoku. So while warping, I am not getting the original boundary of the Sudoku.</p> <p><strong>My Question :</strong> </p> <p>How can I warp the image on the correct boundary of the Sudoku, i.e. the red line OR how can I remove the difference between red line and green line? Is there any method for this in OpenCV?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload