play-chess-with-a-webcam API Documentation
args
Created on 2019-12-08
@author: wf
Args
Command Line argument handling
Source code in pcwawc/args.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
board
Board
Bases: object
This class is used to hold the state of a chessboard with pieces positions and the current player's color which player needs to play. It uses the python-chess library by default
Source code in pcwawc/board.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
move(move)
perform the given move
Source code in pcwawc/board.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
boarddetector
BoardDetector
Bases: Observable
detect a chess board's state from the given image
Source code in pcwawc/boarddetector.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
__init__()
construct me
Source code in pcwawc/boarddetector.py
17 18 19 20 21 |
|
boardfinder
BoardFinder
Bases: object
find a chess board in the given image
Source code in pcwawc/boardfinder.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
|
__init__(image, video=None)
construct me from the given input image
Source code in pcwawc/boardfinder.py
213 214 215 216 217 218 219 220 221 |
|
expand(image, title, histograms, corners)
expand the image finding to 8x8 with the given histograms and corners that are e.g. 7x7,7x5,5x5, ...
Source code in pcwawc/boardfinder.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
fieldColor(pos)
determine the field color at the given position
Source code in pcwawc/boardfinder.py
289 290 291 292 293 294 295 296 |
|
findChessBoard(image, title)
find a chess board in the given image and return the trapez polygon for it
Source code in pcwawc/boardfinder.py
282 283 284 285 286 287 |
|
findCorners(image, limit=1, searchWidth=640)
start finding the chessboard with the given limit and the given maximum width of the search image
Source code in pcwawc/boardfinder.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
|
findOuterCorners(searchWidth=640)
find my outer corners as limited by the OpenCV findChessBoard algorithm - to be later expanded
Source code in pcwawc/boardfinder.py
236 237 238 239 240 241 242 243 244 245 246 |
|
getColorFiltered(image, histograms, title, corners)
get color filtered images based on the given histograms
Source code in pcwawc/boardfinder.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
|
getHistograms(image, title, corners)
get the two histograms for the given corners we don't no what the color of the topleft corner is so we start with a guess
Source code in pcwawc/boardfinder.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
|
maskCornerPolygons(image, corners, filterColor)
mask the polygons derived from the given corner points
Source code in pcwawc/boardfinder.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
|
maskPolygon(image, polygon)
mask the given image with the given polygon
Source code in pcwawc/boardfinder.py
298 299 300 301 302 303 |
|
showHistogramDebug(histograms, title, corners)
'show' the debug information for the given histograms by writing a plotted histogram image to the debugImagePath
Source code in pcwawc/boardfinder.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
|
showPolygonDebug(image, title, corners)
draw polygons for debugging on a copy of the given image with the given corners and write result to the debugImagePath with the given title
Source code in pcwawc/boardfinder.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
|
sortPoints(xylist)
staticmethod
sort points clockwise see https://stackoverflow.com/a/59115565/1497139
Source code in pcwawc/boardfinder.py
229 230 231 232 233 234 |
|
Corners
Bases: object
Chess board corners
Source code in pcwawc/boardfinder.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
debugSorting = False
class-attribute
instance-attribute
pixel margin for masked polygons
__init__(pattern, video)
initialize me with the given rows and columns
Source code in pcwawc/boardfinder.py
31 32 33 34 35 36 37 |
|
asPolygons(safetyMargin)
get the polygons for my corner points
Source code in pcwawc/boardfinder.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
calcPolygons(*safetyMargins)
calculate polygons for the given safety margins
Source code in pcwawc/boardfinder.py
127 128 129 130 |
|
calcTrapez()
calculate the relevant quadrilaterals
Source code in pcwawc/boardfinder.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
findPattern(image)
try finding the chess board corners in the given image with the given pattern
Source code in pcwawc/boardfinder.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
genChessPatterns()
staticmethod
generate the patterns 7x7, 5x7, 3x7, 5x5, 5x3, 3x3
Source code in pcwawc/boardfinder.py
39 40 41 42 43 44 |
|
safeXY(x, y, dx, dy)
return the given x,y tuple shifted by dx,dy making sure the result is not out of my width and height bounds
Source code in pcwawc/boardfinder.py
84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
showDebug(image, title)
'show' the debug picture of the chessboard corners by drawing the corners and writing the result to the given testImagePath
Source code in pcwawc/boardfinder.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
showTrapezDebug(image, title, corners)
'show' a debug picture with the extrapolated quadrilaterals by writing an image to the debugImagePath
Source code in pcwawc/boardfinder.py
158 159 160 161 162 163 164 165 166 167 168 |
|
sort()
sort the corners - this step is currently not implemented so the corners stay rotated
Source code in pcwawc/boardfinder.py
51 52 53 54 55 56 57 58 59 60 61 |
|
trapezColRows(cols, rows)
return an expanded trapez with the given number of columns and rows
Source code in pcwawc/boardfinder.py
149 150 151 152 153 154 155 156 |
|
chessengine
Created on 2019-12-16
@author: wf
Engine
Chess Engines support e.g. Universal Chess Interface see https://chessprogramming.wikispaces.com/UCI
Source code in pcwawc/chessengine.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
__init__(engineConfig, timeout=5)
construct me with the given engineConfiguration and timeout
Parameters:
Name | Type | Description | Default |
---|---|---|---|
engineConfig(dict) |
the engine configuration to use |
required | |
timeout(float) |
the number of seconds to wait of the given engine |
required |
Source code in pcwawc/chessengine.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
close()
close the given engine
Source code in pcwawc/chessengine.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
findEngines()
staticmethod
check which engines from the Engine configurations are installed on this computer and return a dict of these
Returns:
Name | Type | Description |
---|---|---|
dict |
map of Engines by Command e.g. "gnuchess" or "stockfish" |
Source code in pcwawc/chessengine.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
open()
open this chess engine
Source code in pcwawc/chessengine.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
chessimage
Created on 2019-12-10
@author: wf
ChessBoardImage
a chessboard image and it's transformations
Source code in pcwawc/chessimage.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
ChessBoardImageSet
a set of images of the current chess board
Source code in pcwawc/chessimage.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
placeHolder(cbImage)
return an empty image if the image is not available
Source code in pcwawc/chessimage.py
123 124 125 126 127 128 129 130 |
|
warpAndRotate(nowarp=False)
warp and rotate the image as necessary - add timestamp if in debug mode
Source code in pcwawc/chessimage.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
ChessBoardVision
Bases: JsonAbleMixin
implements access to chessboard images
Source code in pcwawc/chessimage.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
Warp
Bases: YamlAbleMixin
, JsonAbleMixin
holds the trapezoid points to be use for warping an image take from a peculiar angle
Source code in pcwawc/chessimage.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
addPoint(px, py)
add a point with the given px,py coordinate to the warp points make sure we have a maximum of 4 warpPoints if warppoints are complete when adding reset them this allows to support click UIs that need an unwarped image before setting new warp points. px,py is irrelevant for reset
Source code in pcwawc/chessimage.py
204 205 206 207 208 209 210 211 212 213 |
|
rotate(angle)
rotate me by the given angle
Source code in pcwawc/chessimage.py
189 190 191 192 193 |
|
updatePoints()
update my points
Source code in pcwawc/chessimage.py
195 196 197 198 199 200 201 202 |
|
chesstrapezoid
ChessTSquare
a chess square in it's trapezoidal perspective
Source code in pcwawc/chesstrapezoid.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
|
__init__(trapez, square)
construct me from the given trapez and square
Source code in pcwawc/chesstrapezoid.py
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 |
|
checkMoved(detectState)
check a figure has been moved, so that the state of this square has changed
Source code in pcwawc/chesstrapezoid.py
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 |
|
drawDebug(image, color=(255, 255, 255))
draw debug information onto the given image using the given color
Source code in pcwawc/chesstrapezoid.py
669 670 671 672 673 674 675 676 677 678 |
|
drawState(image, transformation, channels)
draw my state onto the given image with the given transformation and number of channels
Source code in pcwawc/chesstrapezoid.py
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 |
|
getSquareImage(cbImage)
get the image of me within the given image
Source code in pcwawc/chesstrapezoid.py
680 681 682 683 684 |
|
setPolygons(trapez, rtl_x, rtl_y, rtr_x, rtr_y, rbr_x, rbr_y, rbl_x, rbl_y)
set my relative and warped polygons from the given relative corner coordinates from top left via top right, bottom right to bottom left
Source code in pcwawc/chesstrapezoid.py
567 568 569 570 571 572 573 574 575 576 577 578 579 580 |
|
squareChange(image, diffImage)
check the changes analyzing the difference image of this square
Source code in pcwawc/chesstrapezoid.py
686 687 688 689 690 691 692 693 694 695 |
|
ChessTrapezoid
Bases: Trapez2Square
Chess board Trapezoid (UK) / Trapezium (US) / Trapez (DE) as seen via a webcam image
Source code in pcwawc/chesstrapezoid.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
|
analyzeColors(cbImage)
get the average colors per fieldState
Source code in pcwawc/chesstrapezoid.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
checkColors(cbImage, averageColors, rangeFactor=1.0)
check the colors against the expectation
Source code in pcwawc/chesstrapezoid.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
|
detectChanges(cbImageSet, detectState)
detect the changes of the given imageset using the given detect state machine
Source code in pcwawc/chesstrapezoid.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
|
drawCircle(image, center, radius, color, thickness=-1)
draw a circle onto the given image at the given center point with the given radius, color and thickness.
Source code in pcwawc/chesstrapezoid.py
159 160 161 162 |
|
drawDebug(image, color=(255, 255, 255))
draw debug information e.g. piecel symbol and an onto the given image
Source code in pcwawc/chesstrapezoid.py
232 233 234 235 236 |
|
drawFieldStates(image, fieldStates, transformation=Transformation.ORIGINAL, channels=3)
draw the states for fields with the given field states e.g. to set the mask image that will filter the trapezoid view according to piece positions when using maskImage
Source code in pcwawc/chesstrapezoid.py
183 184 185 186 187 188 189 190 |
|
drawRCircle(image, rcenter, rradius, color, thickness=-1)
draw a circle with relative coordinates
Source code in pcwawc/chesstrapezoid.py
164 165 166 167 168 169 |
|
genSquares()
generator for all chess squares
Source code in pcwawc/chesstrapezoid.py
153 154 155 156 157 |
|
idealColoredBoard(w, h, transformation=Transformation.IDEAL)
draw an 'ideal' colored board according to a given set of parameters e.g. fieldColor, pieceColor, pieceRadius
Source code in pcwawc/chesstrapezoid.py
218 219 220 221 222 223 |
|
preMoveBoard(w, h)
get an image of the board as it was before any move
Source code in pcwawc/chesstrapezoid.py
225 226 227 228 229 230 |
|
prepareImageSet(cbImageSet)
prepare the image set
Source code in pcwawc/chesstrapezoid.py
192 193 194 195 196 197 198 199 200 201 |
|
rotateIndices(row, col, rotation)
rotate the indices or rows and columns according to the board rotation
Source code in pcwawc/chesstrapezoid.py
140 141 142 143 144 145 146 147 148 149 150 151 |
|
tSquareAt(row, col, rotation=0)
get the trapezoid chessboard square for the given row and column
Source code in pcwawc/chesstrapezoid.py
133 134 135 136 137 138 |
|
updatePieces(fen)
update the piece positions according to the given FEN
Source code in pcwawc/chesstrapezoid.py
175 176 177 178 179 180 181 |
|
Color
Color definitions with maximum lightness difference and calculation of average color for a sample of square with a given fieldState
Source code in pcwawc/chesstrapezoid.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
|
__init__(image)
pick the average color from the given image
Source code in pcwawc/chesstrapezoid.py
423 424 425 426 427 428 429 430 431 432 433 |
|
fixMeans(means, stds, pixels, nonzero)
fix the zero based means to nonzero based see https://stackoverflow.com/a/58891531/1497139
Source code in pcwawc/chesstrapezoid.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
|
FieldColorStats
Bases: object
Color statistics for Fields
Source code in pcwawc/chesstrapezoid.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
|
SquareChange
keep track of changes of a square over time
Source code in pcwawc/chesstrapezoid.py
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
|
__init__(value, stats)
construct me from the given value with the given running stats
Source code in pcwawc/chesstrapezoid.py
504 505 506 507 508 509 510 511 512 513 514 515 |
|
Transformation
Bases: IntEnum
Transformation kind
Source code in pcwawc/chesstrapezoid.py
24 25 26 27 28 29 |
|
Trapez2Square
transform a trapez to a square and back as needed
Source code in pcwawc/chesstrapezoid.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
__init__(topLeft, topRight, bottomRight, bottomLeft)
construct me from the given corner points
Source code in pcwawc/chesstrapezoid.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
relativeToTrapezXY(rx, ry)
convert a relative 0-1 based coordinate to a coordinate in the trapez
Source code in pcwawc/chesstrapezoid.py
56 57 58 59 60 61 62 63 64 65 66 67 |
|
chessvision
Created on 2019-10-10
@author: wf see e.g. https://www.fide.com/FIDE/handbook/LawsOfChess.pdf
FieldState
Bases: IntEnum
the state of a field is a combination of the field color with a piece color + two empty field color options
Source code in pcwawc/chessvision.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
IChessBoard
Bases: Interface
chessboard
Source code in pcwawc/chessvision.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
divideInSquares(width, height)
divide the board in squares based on the given width and height
Source code in pcwawc/chessvision.py
61 62 63 |
|
genSquares()
generate all my squares
Source code in pcwawc/chessvision.py
65 66 67 |
|
updatePieces(fen)
update the piece positions according to the given FEN
Source code in pcwawc/chessvision.py
69 70 71 |
|
IChessBoardImage
Bases: Interface
a single image of a chessboard
Source code in pcwawc/chessvision.py
148 149 150 151 152 153 154 155 156 157 158 159 |
|
diffBoardImage(cbOther)
get the difference image between me an the other chessboard image
Source code in pcwawc/chessvision.py
157 158 159 |
|
IChessBoardImageSet
Bases: Interface
a set of Images
Source code in pcwawc/chessvision.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
prepareGUI()
prepare the gui output e.g. for debugging
Source code in pcwawc/chessvision.py
143 144 145 |
|
warpAndRotate()
warp and rotate the original image
Source code in pcwawc/chessvision.py
140 141 |
|
IChessBoardVision
Bases: Interface
Source code in pcwawc/chessvision.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
debug = Attribute('true for debugging')
class-attribute
instance-attribute
visual observer of a chessboard e.g. with a camera - a video or still image
close()
close the access to the chessboard images
Source code in pcwawc/chessvision.py
108 109 110 |
|
open(device)
open the access to the chessboard images via the given device e.g. device number or filepath
Source code in pcwawc/chessvision.py
100 101 102 |
|
readChessBoardImage()
read a chessboard Image and return it
Source code in pcwawc/chessvision.py
104 105 106 |
|
IGame
Bases: Interface
a chess game
Source code in pcwawc/chessvision.py
50 51 52 53 |
|
IMoveDetector
Bases: Interface
a detector for moves on a chessboard image
Source code in pcwawc/chessvision.py
162 163 164 165 166 167 168 169 170 171 172 173 |
|
onChessBoardImage(imageEvent)
event handler for image events
Source code in pcwawc/chessvision.py
171 172 173 |
|
setup(name, board, video, args)
setup the detector with the given board, video and arguments
Source code in pcwawc/chessvision.py
168 169 |
|
IPiece
Bases: Interface
a chess piece King,Queen,Bishop,Knight,Rook or Pawn
Source code in pcwawc/chessvision.py
87 88 89 90 |
|
ISquare
Bases: Interface
one of the 64 square fields of a chessboard
Source code in pcwawc/chessvision.py
74 75 76 77 78 79 80 81 82 83 84 |
|
getSquareImage(cbImage)
get the 1/64 subimage of this square for the given chessboard image
Source code in pcwawc/chessvision.py
82 83 84 |
|
IWarp
Bases: Interface
trapez to square warp point handling
Source code in pcwawc/chessvision.py
113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
addPoint(px, py)
add the given point to the warp point list
Source code in pcwawc/chessvision.py
123 124 125 |
|
rotate(angle)
rotate me with the given angle
Source code in pcwawc/chessvision.py
116 117 118 |
|
updatePoints()
update the points
Source code in pcwawc/chessvision.py
120 121 |
|
config
Created on 2019-12-31
@author: wf
Config
configuration for Play Chess With a WebCam
Source code in pcwawc/config.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
detectorfactory
Created on 2019-12-14
@author: wf
detectstate
Created on 27.11.2019
we could have used: see https://github.com/pytransitions/transitions see https://www.zeolearn.com/magazine/writing-maintainable-code-using-sate-machines-in-python but we don't for the time being
@author: wf
ChangeState
Bases: IntEnum
Source code in pcwawc/detectstate.py
18 19 20 21 22 23 24 25 26 27 |
|
DetectColorState
Bases: object
detect state from Color Distribution
Source code in pcwawc/detectstate.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
inRange(stats, fs, percent)
check if the given percent value is in the range for the given fieldStats
Source code in pcwawc/detectstate.py
113 114 115 116 117 |
|
squareState(fieldColorStats, tSquare, percent)
determine the state of the given field tSquare with the given percent of pixels that fit the expectation
Source code in pcwawc/detectstate.py
119 120 121 122 123 124 |
|
DetectState
Bases: object
keeps track of the detections state
Source code in pcwawc/detectstate.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
__init__(validDiffSumTreshold, invalidDiffSumTreshold, diffSumDeltaTreshold, onPieceMoveDetected=None, onMoveDetected=None)
construct me
Source code in pcwawc/detectstate.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
check(validChanges, diffSum, diffSumDelta, meanFrameCount)
check the detection state given the current diffSum and diffSumDelta
Source code in pcwawc/detectstate.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
environment
Environment
Runtime Environment
Source code in pcwawc/environment.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
__init__()
get the directory in which the testMedia resides
Source code in pcwawc/environment.py
14 15 16 17 18 19 20 |
|
inContinuousIntegration()
staticmethod
are we in a Continuous Integration Environment?
Source code in pcwawc/environment.py
33 34 35 36 37 38 39 40 |
|
environment4test
Environment4Test
Bases: Environment
Test Environment
Source code in pcwawc/environment4test.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
__init__(headless=None)
constructor
Source code in pcwawc/environment4test.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
getImage(num)
get the image with the given number
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num(int) |
the index of the image |
required |
Source code in pcwawc/environment4test.py
104 105 106 107 108 109 110 111 112 113 114 |
|
getImageWithVideo(num)
get the image and video
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num(int) |
the number of the image |
required |
Returns:
Name | Type | Description |
---|---|---|
image |
the image |
|
video |
the video display |
Source code in pcwawc/environment4test.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
getVideo()
get a Video (potentially headless)
Returns:
Name | Type | Description |
---|---|---|
Video |
Video
|
the video handler for openCV |
Source code in pcwawc/environment4test.py
116 117 118 119 120 121 122 123 124 125 |
|
prepareFromImageInfo(imageInfo)
prepare a test environment from the given image Inforrmation
Source code in pcwawc/environment4test.py
145 146 147 148 149 150 151 152 |
|
ImageInfo
information about a chessboard test image
Source code in pcwawc/environment4test.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
__init__(index, title, path, fen, rotation, warpPoints)
constructor
Source code in pcwawc/environment4test.py
17 18 19 20 21 22 23 24 25 26 |
|
eventhandling
Created on 2019-12-13
@author: wf
Event handling module see https://stackoverflow.com/a/1925836/1497139
Event
Bases: object
an Event
Source code in pcwawc/eventhandling.py
10 11 12 13 |
|
Observable
Bases: object
an Observable
Source code in pcwawc/eventhandling.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
field
Field
a single Field of a chess board as observed from a WebCam
Source code in pcwawc/field.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
|
interPolate(rx, ry)
interpolate the given relative coordinate
Source code in pcwawc/field.py
225 226 227 228 229 230 |
|
FieldROI
a region of interest within the square image area of pixels represented by some pixels
Source code in pcwawc/field.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
pixelList()
generate a pixel list by using the generated relative position from
Source code in pcwawc/field.py
96 97 98 99 100 101 102 103 |
|
Grid
Grid Info in the region of interest
Source code in pcwawc/field.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
SquareKind
Bases: IntEnum
kind of Square
Source code in pcwawc/field.py
17 18 19 20 21 22 23 24 25 26 27 28 |
|
fpscheck
FPSCheck
Bases: object
Frame per second tracker
Source code in pcwawc/fpscheck.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
game
Game
Bases: JsonAbleMixin
keeps track of a games state
Source code in pcwawc/game.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
WebCamGame
Bases: Game
keeps track of a webcam games state
Source code in pcwawc/game.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
histogram
Created on 2019-11-29
@author: wf
Histogram
Image Histogram
Source code in pcwawc/histogram.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
|
__init__(image, histSize=256, histRange=(0, 256))
construct me from the given image hist Size and histRange
Source code in pcwawc/histogram.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
colorMask(image, rangeFactor)
create a color mask for this histogram and apply it to the given image
Source code in pcwawc/histogram.py
110 111 112 113 114 115 |
|
Stats
Calculate Histogram statistics see https://math.stackexchange.com/questions/857566/how-to-get-the-standard-deviation-of-a-given-histogram-image
Source code in pcwawc/histogram.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
range(relFactor=1.0, minValue=0, maxValue=255)
return a range relative to my min max range to widen e.g. by 10% use factor 1.1
Source code in pcwawc/histogram.py
44 45 46 47 48 49 50 51 52 |
|
jsonablemixin
JsonAbleMixin
Bases: object
allow reading and writing derived objects from a json file
Source code in pcwawc/jsonablemixin.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
lichessbridge
Created on 2019-12-21
@author: wf
Account
" Lichess account wrapper
Source code in pcwawc/lichessbridge.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
Game
Bases: Thread
, Observable
Lichess game
Source code in pcwawc/lichessbridge.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
Lichess
Lichess adapter
Source code in pcwawc/lichessbridge.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
waitForChallenge(timeout=1000, pollInterval=0.5)
wait for a challend and return the corresponding game
Source code in pcwawc/lichessbridge.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
State
Lichess state wrapper
Source code in pcwawc/lichessbridge.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
plotlib
PlotLib
Bases: object
create matplotlib based multipage diagrams e.g. color channel histograms of images
Source code in pcwawc/plotlib.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
__init__(title, pagesize, imagesPerPage=4)
Constructor
Source code in pcwawc/plotlib.py
26 27 28 29 30 31 32 33 34 |
|
PlotType
Bases: IntEnum
kind of Plot
Source code in pcwawc/plotlib.py
14 15 16 17 18 |
|
runningstats
ColorStats
calculate the RunningStats for 3 color channels like RGB or HSV simultaneously
Source code in pcwawc/runningstats.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
distance(this, other)
staticmethod
simple eucledian color distance see e.g. https://en.wikipedia.org/wiki/Color_difference
Source code in pcwawc/runningstats.py
206 207 208 209 210 211 212 213 |
|
IStats
Bases: Interface
statistics interface
Source code in pcwawc/runningstats.py
11 12 13 14 15 16 17 18 19 20 |
|
mean()
get the mean value
Source code in pcwawc/runningstats.py
18 19 20 |
|
push(value)
push a value to the statistics
Source code in pcwawc/runningstats.py
14 15 16 |
|
MinMaxStats
Bases: RunningStats
, MinMaxMixin
running statistics with minimum and maximum
Source code in pcwawc/runningstats.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
MovingAverage
calculate a moving average
Source code in pcwawc/runningstats.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
push(value)
recalculate the Moving Average based on a new value
Source code in pcwawc/runningstats.py
34 35 36 37 38 39 40 41 42 |
|
RunningStats
calculate mean, variance and standard deviation in one pass using Welford's algorithm
Source code in pcwawc/runningstats.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
simpledetector
Created on 2019-12-07
@author: tk
ImageChange
detect change of a single image
Source code in pcwawc/simpledetector.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
Simple8x8Detector
Bases: SimpleDetector
a simple treshold per field detector
Source code in pcwawc/simpledetector.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
|
SimpleDetector
Bases: Observable
a simple treshold detector
Source code in pcwawc/simpledetector.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
__init__()
construct me
Source code in pcwawc/simpledetector.py
110 111 112 113 114 115 116 |
|
video
Video
Video handling e.g. recording/writing
Source code in pcwawc/video.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
|
createBlank(width, height, rgb_color=(0, 0, 0))
Create new image(numpy array) filled with certain color in RGB
Source code in pcwawc/video.py
302 303 304 305 306 307 308 309 310 311 312 |
|
drawPolygon(image, polygon, color)
draw the given polygon onto the given image with the given color
Source code in pcwawc/video.py
374 375 376 |
|
drawTrapezoid(image, points, color)
loop over the given points and draw them on the image
Source code in pcwawc/video.py
354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
getEmptyImage(image, channels=1)
prepare a trapezoid/polygon mask to focus on the square chess field seen as a trapezoid
Source code in pcwawc/video.py
319 320 321 322 323 |
|
getEmptyImage4WidthAndHeight(w, h, channels)
get an empty image with the given width height and channels
Source code in pcwawc/video.py
314 315 316 317 |
|
houghTransform(image)
Performs an Hough Transform to given image.
Returns: lines
Source code in pcwawc/video.py
333 334 335 336 337 338 339 340 |
|
houghTransformP(image)
Performs a probabilistic Hough Transform to given image.
Returns: lines
Source code in pcwawc/video.py
342 343 344 345 346 347 348 349 350 351 352 |
|
maskImage(image, mask)
return the masked image that filters with the given mask
Source code in pcwawc/video.py
325 326 327 328 |
|
setup(cap)
setup the capturing from the given device
Source code in pcwawc/video.py
82 83 84 85 86 87 88 89 |
|
showImage(image, title, keyCheck=True, keyWait=5)
show the image with the given title
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
the image to show |
required | |
title(str) |
the title of the image |
required | |
keyCheck(bool) |
wait for a a key stroke before continuing? |
required | |
keyWait(int) |
maximum number of seconds to wait for a key stroke |
required |
Source code in pcwawc/video.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
warp(image, pts, squared=True)
apply the four point transform to obtain a birds eye view of the given image
Source code in pcwawc/video.py
408 409 410 411 412 413 414 415 |
|
VideoStream
Bases: object
run videograbbing in separate stream
Source code in pcwawc/video.py
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 |
|
videoanalyze
Created on 2019-12-08
@author: wf
VideoAnalyzer
Bases: Observable
analyzer for chessboard videos - may be used from command line or web app
Source code in pcwawc/videoanalyze.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
webapp
WebApp
actual Play Chess with a WebCam Application - Flask calls are routed here
Source code in pcwawc/webapp.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
__init__(args, logger=None)
construct me
Source code in pcwawc/webapp.py
20 21 22 23 24 25 26 27 28 |
|
getEvent()
this could be any function that blocks until data is ready
Source code in pcwawc/webapp.py
243 244 245 246 247 |
|
webchesscam
WebChessCamArgs
Bases: Args
This class parses command line arguments and generates a usage.
Source code in pcwawc/webchesscam.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
chessUpdate()
set game status from the given pgn, fen or move
Source code in pcwawc/webchesscam.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
yamlablemixin
YamlAbleMixin
Bases: object
allow reading and writing derived objects from a yaml file
Source code in pcwawc/yamlablemixin.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|