Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hansalemaos/npchessimage
Creates a chessboard pattern as an image.
https://github.com/hansalemaos/npchessimage
chessboard cv2 image numpy
Last synced: 5 days ago
JSON representation
Creates a chessboard pattern as an image.
- Host: GitHub
- URL: https://github.com/hansalemaos/npchessimage
- Owner: hansalemaos
- License: mit
- Created: 2023-07-19T01:29:35.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-19T01:30:14.000Z (over 1 year ago)
- Last Synced: 2024-10-12T16:40:58.437Z (about 1 month ago)
- Topics: chessboard, cv2, image, numpy
- Language: Python
- Homepage: https://pypi.org/project/npchessimage/
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Creates a chessboard pattern as an image.
## pip install npchessimage
#### Tested against Windows 10 / Python 3.10 / Anaconda
![](https://github.com/hansalemaos/screenshots/blob/main/testimage.png?raw=true)
```python
Args:
block_size (int, optional): The size of each square block on the chessboard. Defaults to 10.
width (int, optional): The total width of the chessboard image. Defaults to 1000.
height (int, optional): The total height of the chessboard image. Defaults to 1000.
colors (tuple or list, optional): The RGB color values for the chessboard. Defaults to ((0, 0, 0), (255, 0, 0), (255, 255, 0)).Returns:
numpy.ndarray: The generated chessboard image as a NumPy array.Example:
from npchessimage import create_chessboardchessboard = create_chessboard(block_size=20, width=800, height=600, colors=((255, 255, 255), (0, 0, 0)))
print(chessboard.shape)# Output:
# (600, 800, 3)img = create_chessboard(
block_size=10,
width=200,
height=300,
colors=((0, 0, 0), (255, 0, 0), (255, 255, 0)),
)
import cv2
cv2.imwrite('c:\\testimage.png',img)
```