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:
mehlukas
2020-04-07 16:14:51 +02:00
committed by GitHub
parent 734771418e
commit 75bd9f86b2
11 changed files with 118 additions and 352 deletions

View File

@@ -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]