diff --git a/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp b/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp index b020c5ec13..700e27fc6c 100644 --- a/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp +++ b/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp @@ -129,8 +129,8 @@ Mat& ScanImageAndReduceC(Mat& I, const uchar* const table) int channels = I.channels(); - int nRows = I.rows * channels; - int nCols = I.cols; + int nRows = I.rows; + int nCols = I.cols * channels; if (I.isContinuous()) {