mirror of
https://github.com/zebrajr/opencv.git
synced 2026-01-15 12:15:17 +00:00
Merge pull request #16889 from mehlukas:3.4-consolidateImshow
* consolidate tutorials on image read/display/write * fix unsused variables * apply requested changes * apply requested changes * fix mistake
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
## [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]
|
||||
Reference in New Issue
Block a user