Download samples/python/tutorial_code/introduction/display_image/display_image.py from tgollogly/test: direct link, hf CLI and curl.
- Browser
- Download file 372 Bytes
-
https://huggingface.co/tgollogly/test/resolve/main/samples/python/tutorial_code/introduction/display_image/display_image.py
- Command line
-
hf download hf://tgollogly/test/samples/python/tutorial_code/introduction/display_image/display_image.py
-
curl -L -o display_image.py https://huggingface.co/tgollogly/test/resolve/main/samples/python/tutorial_code/introduction/display_image/display_image.py
372 Bytes
| ## [imports] | |
| import cv2 as cv | |
| import sys | |
| ## [imports] | |
| ## [imread] | |
| img = cv.imread(cv.samples.findFile("starry_night.jpg")) | |
| ## [imread] | |
| ## [empty] | |
| if img is None: | |
| sys.exit("Could not read the image.") | |
| ## [empty] | |
| ## [imshow] | |
| cv.imshow("Display window", img) | |
| k = cv.waitKey(0) | |
| ## [imshow] | |
| ## [imsave] | |
| if k == ord("s"): | |
| cv.imwrite("starry_night.png", img) | |
| ## [imsave] | |