Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hansalemaos/cv2_collage_v2
Creates a collage from images with OpenCV
https://github.com/hansalemaos/cv2_collage_v2
collage opencv
Last synced: 6 days ago
JSON representation
Creates a collage from images with OpenCV
- Host: GitHub
- URL: https://github.com/hansalemaos/cv2_collage_v2
- Owner: hansalemaos
- License: mit
- Created: 2023-04-23T12:07:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-04-23T12:08:27.000Z (over 1 year ago)
- Last Synced: 2024-10-12T16:22:49.101Z (about 1 month ago)
- Topics: collage, opencv
- Language: Python
- Homepage: https://pypi.org/project/cv2-collage-v2
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Creates a collage from images with OpenCV
## pip install cv2-collage-v2
# Tested against Windows 10 / Python 3.10 / Anaconda
## How to use it
```python
from cv2_collage_v2 import create_collage_v2
import os
import cv2
folder=r'C:\Users\hansc\Downloads\bd'
allpics =[]
for f in os.listdir(folder):
try:
allpics.append(cv2.imread(os.path.join(folder,f)))
except Exception as fe:
print(fe)
continuecollage=create_collage_v2(allpics,maxwidth = 1500,heightdiv=16,widthdiv=5,background=(0, 0, 0),save_path='e:\\nyhctest.png',)
cv2.imshow('Collage', collage)
cv2.waitKey(0)
cv2.destroyAllWindows()Args:
lst (list|tuple): A list or tuple of images - allowed: [file paths, base64, bytes, PIL, urls, np.array].
maxwidth (int, optional): The maximum width of the collage. Defaults to 1080.
heightdiv (int, optional): The height division factor. Defaults to 6.
widthdiv (int, optional): The width division factor. Defaults to 2.
background (tuple, optional): The background color of the collage. Defaults to (0, 0, 0).
save_path (str|None, optional): The file path to save the collage. Defaults to None.Returns:
np.array: A NumPy array representing the collage image.```
![](https://github.com/hansalemaos/screenshots/blob/main/nyhctest.png?raw=true)