How to remove convexity defects in a Sudoku square?

前端 未结 6 1025
庸人自扰
庸人自扰 2020-11-22 08:29

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 probl

6条回答
  •  生来不讨喜
    2020-11-22 09:08

    To remove undected corners I applied gamma correction with a gamma value of 0.8.

    The red circle is drawn to show the missing corner.

    The code is:

    gamma = 0.8
    invGamma = 1/gamma
    table = np.array([((i / 255.0) ** invGamma) * 255
                      for i in np.arange(0, 256)]).astype("uint8")
    cv2.LUT(img, table, img)
    

    This is in addition to Abid Rahman's answer if some corner points are missing.

提交回复
热议问题