1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

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
+2 -2
View File
@@ -80,7 +80,7 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, float squareSize, b
for( k = 0; k < 2; k++ )
{
const string& filename = imagelist[i*2+k];
Mat img = imread(filename, 0);
Mat img = imread(filename, IMREAD_GRAYSCALE);
if(img.empty())
break;
if( imageSize == Size() )
@@ -298,7 +298,7 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, float squareSize, b
{
for( k = 0; k < 2; k++ )
{
Mat img = imread(goodImageList[i*2+k], 0), rimg, cimg;
Mat img = imread(goodImageList[i*2+k], IMREAD_GRAYSCALE), rimg, cimg;
remap(img, rimg, rmap[k][0], rmap[k][1], INTER_LINEAR);
cvtColor(rimg, cimg, COLOR_GRAY2BGR);
Mat canvasPart = !isVerticalStereo ? canvas(Rect(w*k, 0, w, h)) : canvas(Rect(0, h*k, w, h));