Difference between revisions of "PlayChessWithAWebCam/BoardFinder"
Jump to navigation
Jump to search
Line 7: | Line 7: | ||
Still it is very helpful and used as a basis for the BoardFinder. | Still it is very helpful and used as a basis for the BoardFinder. | ||
+ | === Initializing the BoardFinder === | ||
+ | <source lang='python'> | ||
+ | def __init__(self, image, video=None,debugImagePath="/tmp/pcwawc/"): | ||
+ | """ construct me from the given input image""" | ||
+ | if video is None: | ||
+ | video=Video() | ||
+ | self.video=video | ||
+ | self.image=image | ||
+ | self.debugImagePath=debugImagePath | ||
+ | self.height, self.width = self.image.shape[:2] | ||
+ | </source> | ||
+ | |||
=== Examples === | === Examples === | ||
see [https://github.com/WolfgangFahl/play-chess-with-a-webcam/tree/master/testMedia testMedia source folder] | see [https://github.com/WolfgangFahl/play-chess-with-a-webcam/tree/master/testMedia testMedia source folder] |
Revision as of 07:27, 1 December 2019
Source Code
see class BoardFinder in module boardfinder tests are in the: test_BoardFinder module
Algorithm
Finding the chessboard
OpenCV has a function findChessboardCorners which is usually used for camera calibration and not really intended for the use case of "real chessboards".
Still it is very helpful and used as a basis for the BoardFinder.
Initializing the BoardFinder
def __init__(self, image, video=None,debugImagePath="/tmp/pcwawc/"):
""" construct me from the given input image"""
if video is None:
video=Video()
self.video=video
self.image=image
self.debugImagePath=debugImagePath
self.height, self.width = self.image.shape[:2]