Merge pull request #23108 from crackwitz:issue-23107

Usage of imread(): magic number 0, unchecked result

* docs: rewrite 0/1 to IMREAD_GRAYSCALE/IMREAD_COLOR in imread()

* samples, apps: rewrite 0/1 to IMREAD_GRAYSCALE/IMREAD_COLOR in imread()

* tests: rewrite 0/1 to IMREAD_GRAYSCALE/IMREAD_COLOR in imread()

* doc/py_tutorials: check imread() result
This commit is contained in:
Christoph Rackwitz
2023-01-09 01:55:31 -08:00
committed by GitHub
parent 7b7774476e
commit a64b51dd94
57 changed files with 129 additions and 74 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ def main():
def processImage(fn):
print('processing %s... ' % fn)
img = cv.imread(fn, 0)
img = cv.imread(fn, cv.IMREAD_GRAYSCALE)
if img is None:
print("Failed to load", fn)
return None
+1 -1
View File
@@ -69,7 +69,7 @@ class App():
if ext == "png" or ext == "jpg" or ext == "bmp" or ext == "tiff" or ext == "pbm":
print(infile)
img = cv.imread(infile,1)
img = cv.imread(infile, cv.IMREAD_COLOR)
if img is None:
continue
self.sel = (0,0,0,0)