Skip to content

Commit 2e37262

Browse files
Ethan MaoEthan Mao
authored andcommitted
Add minimal OpenCV Python example to README
1 parent 81b4c07 commit 2e37262

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,18 @@ Starting from 4.3.0 and 3.4.10 builds the Linux build environment was updated fr
253253
Starting from version 4.7.0 the Mac OS GitHub Actions build environment was update to version 11. Mac OS 10.x support deprecated. See https://github.com/actions/runner-images/issues/5583
254254

255255
Starting from version 4.9.0 the Mac OS GitHub Actions build environment was update to version 12. Mac OS 10.x support deprecated by Brew and most of used packages.
256+
257+
## Example Usage (Python)
258+
259+
Below is a minimal example that loads an image, converts it to grayscale, and saves the output.
260+
261+
```python
262+
import cv2
263+
264+
img = cv2.imread("input.jpg")
265+
if img is None:
266+
raise FileNotFoundError("Could not read input.jpg")
267+
268+
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
269+
cv2.imwrite("output_gray.jpg", gray)
270+
print("Saved output_gray.jpg")

0 commit comments

Comments
 (0)