nareshmlx/opencv-pr huggingface dataset:
**File:** samples/cpp/ela.cpp
**Change Type:** added
**Context:** PR #11819: Include ELA example -  ### This pullrequest changes  This example performs an Error Level Analysis in the image provided using the same tec...

**Code Changes:**
```diff
@@ -0,0 +1,79 @@
+/**
+  @file ela.cpp
+  @author Alessandro de Oliveira Faria (A.K.A. CABELO)
+  @brief Error Level Analysis (ELA) permits identifying areas within an image that are at different compression levels. With JPEG images, the entire picture should be at roughly the same level. If a section of the image is at a significantly different error level, then it likely indicates a digital modification. This example allows to see visually the changes made in a JPG image based in it's compression error analysis. Questions and suggestions email to: Alessandro de Oliveira Faria cabelo[at]opensuse[dot]org or OpenCV Team.
+  @date Jun 24, 2018
+*/
+
+#include <opencv2/highgui/highgui.hpp>
+#include <iostream>
```

Review comment:
replace this loop with `absdiff` and `convertTo`
**File:** samples/cpp/ela.cpp
**Change Type:** added
**Context:** PR #11819: Include ELA example -  ### This pullrequest changes  This example performs an Error Level Analysis in the image provided using the same tec...

**Code Changes:**
```diff
@@ -0,0 +1,79 @@
+/**
+  @file ela.cpp
+  @author Alessandro de Oliveira Faria (A.K.A. CABELO)
+  @brief Error Level Analysis (ELA) permits identifying areas within an image that are at different compression levels. With JPEG images, the entire picture should be at roughly the same level. If a section of the image is at a significantly different error level, then it likely indicates a digital modification. This example allows to see visually the changes made in a JPG image based in it's compression error analysis. Questions and suggestions email to: Alessandro de Oliveira Faria cabelo[at]opensuse[dot]org or OpenCV Team.
+  @date Jun 24, 2018
+*/
+
+#include <opencv2/highgui/highgui.hpp>
+#include <iostream>
```

Review comment:
do not write compressed image to a file, use `encode` and `decode` functions from imgcodecs.
**File:** samples/cpp/ela.cpp
**Change Type:** added
**Context:** PR #11819: Include ELA example -  ### This pullrequest changes  This example performs an Error Level Analysis in the image provided using the same tec...

**Code Changes:**
```diff
@@ -0,0 +1,79 @@
+/**
+  @file ela.cpp
+  @author Alessandro de Oliveira Faria (A.K.A. CABELO)
+  @brief Error Level Analysis (ELA) permits identifying areas within an image that are at different compression levels. With JPEG images, the entire picture should be at roughly the same level. If a section of the image is at a significantly different error level, then it likely indicates a digital modification. This example allows to see visually the changes made in a JPG image based in it's compression error analysis. Questions and suggestions email to: Alessandro de Oliveira Faria cabelo[at]opensuse[dot]org or OpenCV Team.
+  @date Jun 24, 2018
+*/
+
+#include <opencv2/highgui/highgui.hpp>
+#include <iostream>
```

Review comment:
can we use some other image, like lena or fruits or baboon? the provided image is too dark and the interesting texture is only in a small part of it
**File:** samples/cpp/ela.cpp
**Change Type:** added
**Context:** PR #11819: Include ELA example -  ### This pullrequest changes  This example performs an Error Level Analysis in the image provided using the same tec...

**Code Changes:**
```diff
@@ -0,0 +1,79 @@
+/**
+  @file ela.cpp
+  @author Alessandro de Oliveira Faria (A.K.A. CABELO)
+  @brief Error Level Analysis (ELA) permits identifying areas within an image that are at different compression levels. With JPEG images, the entire picture should be at roughly the same level. If a section of the image is at a significantly different error level, then it likely indicates a digital modification. This example allows to see visually the changes made in a JPG image based in it's compression error analysis. Questions and suggestions email to: Alessandro de Oliveira Faria cabelo[at]opensuse[dot]org or OpenCV Team.
+  @date Jun 24, 2018
+*/
+
+#include <opencv2/highgui/highgui.hpp>
+#include <iostream>
```

Review comment:
if there is no image, the app should quit immediately, not wait for a key pressed
**File:** samples/cpp/ela.cpp
**Change Type:** added
**Context:** PR #11819: Include ELA example -  ### This pullrequest changes  This example performs an Error Level Analysis in the image provided using the same tec...

**Code Changes:**
```diff
@@ -0,0 +1,79 @@
+/**
+  @file ela.cpp
+  @author Alessandro de Oliveira Faria (A.K.A. CABELO)
+  @brief Error Level Analysis (ELA) permits identifying areas within an image that are at different compression levels. With JPEG images, the entire picture should be at roughly the same level. If a section of the image is at a significantly different error level, then it likely indicates a digital modification. This example allows to see visually the changes made in a JPG image based in it's compression error analysis. Questions and suggestions email to: Alessandro de Oliveira Faria cabelo[at]opensuse[dot]org or OpenCV Team.
+  @date Jun 24, 2018
+*/
+
+#include <opencv2/highgui/highgui.hpp>
+#include <iostream>
```

Review comment:
very good, done...
**File:** samples/cpp/ela.cpp
**Change Type:** added
**Context:** PR #11819: Include ELA example -  ### This pullrequest changes  This example performs an Error Level Analysis in the image provided using the same tec...

**Code Changes:**
```diff
@@ -0,0 +1,79 @@
+/**
+  @file ela.cpp
+  @author Alessandro de Oliveira Faria (A.K.A. CABELO)
+  @brief Error Level Analysis (ELA) permits identifying areas within an image that are at different compression levels. With JPEG images, the entire picture should be at roughly the same level. If a section of the image is at a significantly different error level, then it likely indicates a digital modification. This example allows to see visually the changes made in a JPG image based in it's compression error analysis. Questions and suggestions email to: Alessandro de Oliveira Faria cabelo[at]opensuse[dot]org or OpenCV Team.
+  @date Jun 24, 2018
+*/
+
+#include <opencv2/highgui/highgui.hpp>
+#include <iostream>
```

Review comment:
This example show the region modified in photoshop (linux logo). so I added these images. I can put the images in my site to download. What do you think about this?
**File:** modules/videoio/src/cap_msmf.cpp
**Change Type:** modified
**Context:** PR #11702: Fixed setting of frame size properties for MSMF-based VideoCapture - ### This pullrequest changes Fix setting of frame size properties for ...

**Code Changes:**
```diff
@@ -720,6 +720,7 @@ class CvCapture_MSMF : public cv::IVideoCapture
     MediaType nativeFormat;
     MediaType captureFormat;
     int outputFormat;
+    UINT32 requestedWidth, requestedHeight;
     bool convertFormat;
     UINT32 aspectN, aspectD;
     MFTIME duration;
@@ -741,19 +742,23 @@ CvCapture_MSMF::CvCapture_MSMF():
     videoFileSource(NULL),
```

Review comment:
the conditions look too complex. Can we simplify them? e.g. <pre> int best_diff = INT_MAX; for( ... ) { ... int temp_width = width > 0 ? width : MT.width; int temp_height = height > 0 ? height : MT.height; int diff = abs(temp_width - MT.width) + abs(temp_height - MT.heighT); if( diff < best_diff ) { MTbest = MT; best_diff = diff; } } </pre>
**File:** modules/videoio/src/cap_msmf.cpp
**Change Type:** modified
**Context:** PR #11702: Fixed setting of frame size properties for MSMF-based VideoCapture - ### This pullrequest changes Fix setting of frame size properties for ...

**Code Changes:**
```diff
@@ -720,6 +720,7 @@ class CvCapture_MSMF : public cv::IVideoCapture
     MediaType nativeFormat;
     MediaType captureFormat;
     int outputFormat;
+    UINT32 requestedWidth, requestedHeight;
     bool convertFormat;
     UINT32 aspectN, aspectD;
     MFTIME duration;
@@ -741,19 +742,23 @@ CvCapture_MSMF::CvCapture_MSMF():
     videoFileSource(NULL),
```

Review comment:
I've refactored the code. Now it should be more readable
**File:** modules/videoio/src/cap_msmf.cpp
**Change Type:** modified
**Context:** PR #11702: Fixed setting of frame size properties for MSMF-based VideoCapture - ### This pullrequest changes Fix setting of frame size properties for ...

**Code Changes:**
```diff
@@ -720,6 +720,7 @@ class CvCapture_MSMF : public cv::IVideoCapture
     MediaType nativeFormat;
     MediaType captureFormat;
     int outputFormat;
+    UINT32 requestedWidth, requestedHeight;
     bool convertFormat;
     UINT32 aspectN, aspectD;
     MFTIME duration;
@@ -741,19 +742,23 @@ CvCapture_MSMF::CvCapture_MSMF():
     videoFileSource(NULL),
```

Review comment:
> isOpen ? How we can create `cv::VideoCapture` where `isOpen == false`? In this case VideoCapture should trying the next backend from the list of enabled/available, and lost "this" instance. How should we write MSMF test to test both branches of this condition?
**File:** modules/dnn/src/tensorflow/tf_importer.cpp
**Change Type:** modified
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.

**Code Changes:**
```diff
@@ -1450,18 +1450,36 @@ void TFImporter::populateNet(Net dstNet)
             connect(layer_id, dstNet, parsePin(layer.input(1)), id, 0);
             data_layouts[name] = DATA_LAYOUT_UNKNOWN;
         }
-        else if (type == "ResizeNearestNeighbor")
+        else if (type == "ResizeNearestNeighbor" || type == "ResizeBilinear")
         {
-            Mat outSize = getTensorContent(getConstBlob(layer, value_id, 1));
-            CV_Assert(outSize.type() == CV_32SC1, outSize.total() == 2);
+            if (layer.input_size() == 2)
```

Review comment:
Enumerations `INTER_NEAREST` and `INTER_LINEAR` are also integers. You can just set them as arguments, `layerParams.set("interpolation", INTER_NEAREST);` and use `interpolation` like `resize(getPlane(inp, n, ch), getPlane(out, n, ch), Size(outWidth, outHeight), 0, 0, interpolation);`
**File:** modules/dnn/src/tensorflow/tf_importer.cpp
**Change Type:** modified
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.

**Code Changes:**
```diff
@@ -1450,18 +1450,36 @@ void TFImporter::populateNet(Net dstNet)
             connect(layer_id, dstNet, parsePin(layer.input(1)), id, 0);
             data_layouts[name] = DATA_LAYOUT_UNKNOWN;
         }
-        else if (type == "ResizeNearestNeighbor")
+        else if (type == "ResizeNearestNeighbor" || type == "ResizeBilinear")
         {
-            Mat outSize = getTensorContent(getConstBlob(layer, value_id, 1));
-            CV_Assert(outSize.type() == CV_32SC1, outSize.total() == 2);
+            if (layer.input_size() == 2)
```

Review comment:
Body of that case is absolutely the same. Can you just extend the previous one by `else if (type == "ResizeNearestNeighbor" || type == "ResizeBilinear")` and vary "interpolation" flag?
**File:** modules/dnn/src/init.cpp
**Change Type:** modified
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.

**Code Changes:**
```diff
@@ -83,7 +83,7 @@ void initializeLayerFactory()
     CV_DNN_REGISTER_LAYER_CLASS(Concat,         ConcatLayer);
     CV_DNN_REGISTER_LAYER_CLASS(Reshape,        ReshapeLayer);
     CV_DNN_REGISTER_LAYER_CLASS(Flatten,        FlattenLayer);
-    CV_DNN_REGISTER_LAYER_CLASS(ResizeNearestNeighbor, ResizeNearestNeighborLayer);
+    CV_DNN_REGISTER_LAYER_CLASS(Resize,         ResizeLayer);
     CV_DNN_REGISTER_LAYER_CLASS(CropAndResize,  CropAndResizeLayer);
 
     CV_DNN_REGISTER_LAYER_CLASS(Convolution,    ConvolutionLayer);
```

Review comment:
Please align `ResizeLayer` with the other layers names.
**File:** modules/dnn/src/tensorflow/tf_importer.cpp
**Change Type:** modified
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.

**Code Changes:**
```diff
@@ -1450,18 +1450,36 @@ void TFImporter::populateNet(Net dstNet)
             connect(layer_id, dstNet, parsePin(layer.input(1)), id, 0);
             data_layouts[name] = DATA_LAYOUT_UNKNOWN;
         }
-        else if (type == "ResizeNearestNeighbor")
+        else if (type == "ResizeNearestNeighbor" || type == "ResizeBilinear")
         {
-            Mat outSize = getTensorContent(getConstBlob(layer, value_id, 1));
-            CV_Assert(outSize.type() == CV_32SC1, outSize.total() == 2);
+            if (layer.input_size() == 2)
```

Review comment:
I think `INTER_NEAREST` or `INTER_LINEAR` should be here.
**File:** modules/dnn/src/tensorflow/tf_importer.cpp
**Change Type:** modified
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.

**Code Changes:**
```diff
@@ -1450,18 +1450,36 @@ void TFImporter::populateNet(Net dstNet)
             connect(layer_id, dstNet, parsePin(layer.input(1)), id, 0);
             data_layouts[name] = DATA_LAYOUT_UNKNOWN;
         }
-        else if (type == "ResizeNearestNeighbor")
+        else if (type == "ResizeNearestNeighbor" || type == "ResizeBilinear")
         {
-            Mat outSize = getTensorContent(getConstBlob(layer, value_id, 1));
-            CV_Assert(outSize.type() == CV_32SC1, outSize.total() == 2);
+            if (layer.input_size() == 2)
```

Review comment:
Hi, do you mean replacing the values by them? Then I should define them at the beginning or include imgproc.hpp, right?
**File:** modules/dnn/src/tensorflow/tf_importer.cpp
**Change Type:** modified
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.

**Code Changes:**
```diff
@@ -1450,18 +1450,36 @@ void TFImporter::populateNet(Net dstNet)
             connect(layer_id, dstNet, parsePin(layer.input(1)), id, 0);
             data_layouts[name] = DATA_LAYOUT_UNKNOWN;
         }
-        else if (type == "ResizeNearestNeighbor")
+        else if (type == "ResizeNearestNeighbor" || type == "ResizeBilinear")
         {
-            Mat outSize = getTensorContent(getConstBlob(layer, value_id, 1));
-            CV_Assert(outSize.type() == CV_32SC1, outSize.total() == 2);
+            if (layer.input_size() == 2)
```

Review comment:
Why? They are just defined in OpenCV: https://docs.opencv.org/master/da/d54/group__imgproc__transform.html#ga5bb5a1fea74ea38e1a5445ca803ff121 . And please do not forget to add a test.
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** added
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.

**Code Changes:**
```diff
@@ -0,0 +1,176 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// Copyright (C) 2017, Intel Corporation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include "../op_inf_engine.hpp"
```

Review comment:
Use `.ptr<float>(y0)` and `.ptr<float>(std::min(y0 + 1, inpHeight - 1))`
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** added
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.

**Code Changes:**
```diff
@@ -0,0 +1,176 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+// Copyright (C) 2017, Intel Corporation, all rights reserved.
+// Third party copyrights are property of their respective owners.
+#include "../precomp.hpp"
+#include "layers_common.hpp"
+#include "../op_inf_engine.hpp"
```

Review comment:
`.ptr()`
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** added
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.
**Review Line:** 131

**Code Changes:**
```diff
+                    for (int c = 0; c < numPlanes; ++c)
+                    {
+                        *outData = inpData_row0_c[x0] +
+                            (input_y - y0) * (inpData_row1_c[x0] - inpData_row0_c[x0]) +
+                            (input_x - x0) * (inpData_row0_c[x1] - inpData_row0_c[x0] +
+                            (input_y - y0) * (inpData_row1_c[x1] - inpData_row0_c[x1] - inpData_row1_c[x0] + inpData_row0_c[x0]));
+
+                        inpData_row0_c += inpSpatialSize;
+                        inpData_row1_c += inpSpatialSize;
+                        outData += outSpatialSize;
+                    }
```

Review comment:
Why OpenCV `cv::resize()` with `BORDER_REPLICATE` doesn't work here? (answer: `0.5` pixel center) Anyway, if you want to reuse OpenCV's `INTER_LINEAR` constant then it should have **the same behavior** as defined by this constant.
**File:** modules/dnn/src/layers/resize_layer.cpp
**Change Type:** added
**Context:** PR #11050: Added ResizeBilinear op for tf - ### This pullrequest changes Added ResizeBilinear op for tensorflow importer.
**Review Line:** 131

**Code Changes:**
```diff
+                    for (int c = 0; c < numPlanes; ++c)
+                    {
+                        *outData = inpData_row0_c[x0] +
+                            (input_y - y0) * (inpData_row1_c[x0] - inpData_row0_c[x0]) +
+                            (input_x - x0) * (inpData_row0_c[x1] - inpData_row0_c[x0] +
+                            (input_y - y0) * (inpData_row1_c[x1] - inpData_row0_c[x1] - inpData_row1_c[x0] + inpData_row0_c[x0]));
+
+                        inpData_row0_c += inpSpatialSize;
+                        inpData_row1_c += inpSpatialSize;
+                        outData += outSpatialSize;
+                    }
```

Review comment:
Two different formulas are usually used for resize operation: 1. `x * widthScale` 2. Something like `(x + 0.5) * widthScale - 0.5` The second formula is used in OpenVX, OpenCV's `INTER_LINEAR` resize (and probably generic `INTER_AREA`). The first is used in OpenCV `INTER_NEAREST` (not accurate, but it is fast) / `INTER_AREA` (fast path). Here, we need to use the first formula with "linear" interpolation (to match original framework operation).
**File:** modules/calib3d/src/stereobm.cpp
**Change Type:** modified
**Context:** PR #11610: StereoBM: fixed SIMD processing for fixed-type output arrays - A check is not done before `findStereoCorrespondenceBM_SIMD` call whether ou...

**Code Changes:**
```diff
@@ -284,7 +284,39 @@ prefilterXSobel( const Mat& src, Mat& dst, int ftzero )
 static const int DISPARITY_SHIFT_16S = 4;
 static const int DISPARITY_SHIFT_32S = 8;
 
+template <typename T>
+struct dispShiftTemplate
+{ };
+
+template<>
+struct dispShiftTemplate<short>
```

Review comment:
Please add some check into "else" branch: - `CV_CheckTypeEQ(disp_i.type(), CV_32S, "Only 16S / 32S types are allowed for 'disparity' output")` or "Internal error" message - or `CV_Assert()` if type check is performed before
**File:** modules/calib3d/test/test_stereomatching.cpp
**Change Type:** modified
**Context:** PR #11610: StereoBM: fixed SIMD processing for fixed-type output arrays - A check is not done before `findStereoCorrespondenceBM_SIMD` call whether ou...

**Code Changes:**
```diff
@@ -791,6 +791,12 @@ class CV_StereoBMTest : public CV_StereoMatchingTest
         bm->compute( leftImg, rightImg, tempDisp );
         tempDisp.convertTo(leftDisp, CV_32F, 1./StereoMatcher::DISP_SCALE);
 
+        //check for fixed-type disparity data type
+        Mat_<float> fixedFloatDisp;
+        bm->compute( leftImg, rightImg, fixedFloatDisp );
+        EXPECT_LT(cvtest::norm(fixedFloatDisp, leftDisp, cv::NORM_L2 | cv::NORM_RELATIVE),
+                  0.005 + DBL_EPSILON);
+
```

Review comment:
1. Use **relative** norm L2. 2. Use threshold something like 1e-3.
**File:** modules/calib3d/test/test_stereomatching.cpp
**Change Type:** modified
**Context:** PR #11610: StereoBM: fixed SIMD processing for fixed-type output arrays - A check is not done before `findStereoCorrespondenceBM_SIMD` call whether ou...

**Code Changes:**
```diff
@@ -791,6 +791,12 @@ class CV_StereoBMTest : public CV_StereoMatchingTest
         bm->compute( leftImg, rightImg, tempDisp );
         tempDisp.convertTo(leftDisp, CV_32F, 1./StereoMatcher::DISP_SCALE);
 
+        //check for fixed-type disparity data type
+        Mat_<float> fixedFloatDisp;
+        bm->compute( leftImg, rightImg, fixedFloatDisp );
+        EXPECT_LT(cvtest::norm(fixedFloatDisp, leftDisp, cv::NORM_L2 | cv::NORM_RELATIVE),
+                  0.005 + DBL_EPSILON);
+
```

Review comment:
Threshold of such scale seems unreachable since it's a difference between float-point and short-int calculations. The typical measured (relative L2) error is 0.9375.
**File:** modules/calib3d/src/stereobm.cpp
**Change Type:** modified
**Context:** PR #11610: StereoBM: fixed SIMD processing for fixed-type output arrays - A check is not done before `findStereoCorrespondenceBM_SIMD` call whether ou...

**Code Changes:**
```diff
@@ -284,7 +284,39 @@ prefilterXSobel( const Mat& src, Mat& dst, int ftzero )
 static const int DISPARITY_SHIFT_16S = 4;
 static const int DISPARITY_SHIFT_32S = 8;
 
+template <typename T>
+struct dispShiftTemplate
+{ };
+
+template<>
+struct dispShiftTemplate<short>
```

Review comment:
done, see L1009
**File:** modules/calib3d/test/test_stereomatching.cpp
**Change Type:** modified
**Context:** PR #11610: StereoBM: fixed SIMD processing for fixed-type output arrays - A check is not done before `findStereoCorrespondenceBM_SIMD` call whether ou...

**Code Changes:**
```diff
@@ -791,6 +791,12 @@ class CV_StereoBMTest : public CV_StereoMatchingTest
         bm->compute( leftImg, rightImg, tempDisp );
         tempDisp.convertTo(leftDisp, CV_32F, 1./StereoMatcher::DISP_SCALE);
 
+        //check for fixed-type disparity data type
+        Mat_<float> fixedFloatDisp;
+        bm->compute( leftImg, rightImg, fixedFloatDisp );
+        EXPECT_LT(cvtest::norm(fixedFloatDisp, leftDisp, cv::NORM_L2 | cv::NORM_RELATIVE),
+                  0.005 + DBL_EPSILON);
+
```

Review comment:
> The typical measured (relative L2) error is 0.9375 This means that compared data is almost **not** similar. So you just can not apply this check to verify corectness. Dump these values: ``` std::cout << "norm x256=" << cvtest::norm(fixedFloatDisp * 256, Mat_<float>(tempDisp), cv::NORM_L2 | cv::NORM_RELATIVE, mask) << std::endl; std::cout << "norm x16=" << cvtest::norm(fixedFloatDisp * 16, Mat_<float>(tempDisp), cv::NORM_L2 | cv::NORM_RELATIVE, mask) << std::endl; ``` 16 is `StereoMatcher::DISP_SCALE`, but what is 256? Bug?
**File:** modules/calib3d/src/stereobm.cpp
**Change Type:** modified
**Context:** PR #11610: StereoBM: fixed SIMD processing for fixed-type output arrays - A check is not done before `findStereoCorrespondenceBM_SIMD` call whether ou...

**Code Changes:**
```diff
@@ -284,7 +284,39 @@ prefilterXSobel( const Mat& src, Mat& dst, int ftzero )
 static const int DISPARITY_SHIFT_16S = 4;
 static const int DISPARITY_SHIFT_32S = 8;
 
+template <typename T>
+struct dispShiftTemplate
+{ };
+
+template<>
+struct dispShiftTemplate<short>
```

Review comment:
For C++98 "enum" is preferable for type traits: ``` template<> struct dispShiftTemplate<short> { enum { value = DISPARITY_SHIFT_16S }; }; ```