Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sunsided/python-conv2d
2D image convolution example in Python
https://github.com/sunsided/python-conv2d
2d-convolution image-processing python
Last synced: 3 months ago
JSON representation
2D image convolution example in Python
- Host: GitHub
- URL: https://github.com/sunsided/python-conv2d
- Owner: sunsided
- Created: 2016-11-04T12:52:19.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-15T21:37:22.000Z (over 4 years ago)
- Last Synced: 2024-10-11T02:31:08.266Z (3 months ago)
- Topics: 2d-convolution, image-processing, python
- Language: Python
- Size: 15.6 KB
- Stars: 23
- Watchers: 3
- Forks: 19
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 2D Convolutions in Python (OpenCV 2, numpy)
In order to demonstrate 2D kernel-based filtering without relying on library code too much, `convolutions.py` gives some examples to play around with.
```python
image = cv2.imread('clock.jpg', cv2.IMREAD_GRAYSCALE).astype(float) / 255.0kernel = np.array([[1, 0, -1],
[1, 0, -1],
[1, 0, -1]])filtered = cv2.filter2D(src=image, kernel=kernel, ddepth=-1)
cv2.imshow('horizontal edges', filtered)
```In addition, `convolution_manual.py` implements a manual 2D convolution to explain the concept.