Merge pull request #11984 from mshabunin:fix-static-1
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Tue, 17 Jul 2018 15:40:48 +0000 (15:40 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Tue, 17 Jul 2018 15:40:48 +0000 (15:40 +0000)
1  2 
modules/objdetect/src/qrcode.cpp

@@@ -111,10 -111,11 +111,11 @@@ vector<Vec3d> QRDecode::searchVerticalL
  
                  for (size_t i = 0; i < test_lines.size(); i++) { length += test_lines[i]; }
  
+                 CV_Assert(length > 0);
                  for (size_t i = 0; i < test_lines.size(); i++)
                  {
 -                    if (i == 2) { weight += abs((test_lines[i] / length) - 3.0/7.0); }
 -                    else        { weight += abs((test_lines[i] / length) - 1.0/7.0); }
 +                    if (i == 2) { weight += fabs((test_lines[i] / length) - 3.0/7.0); }
 +                    else        { weight += fabs((test_lines[i] / length) - 1.0/7.0); }
                  }
  
                  if (weight < eps_vertical)
@@@ -182,10 -183,11 +183,11 @@@ vector<Point2f> QRDecode::separateHoriz
  
              for (size_t i = 0; i < test_lines.size(); i++) { length += test_lines[i]; }
  
+             CV_Assert(length > 0);
              for (size_t i = 0; i < test_lines.size(); i++)
              {
 -                if (i % 3 == 0) { weight += abs((test_lines[i] / length) - 3.0/14.0); }
 -                else            { weight += abs((test_lines[i] / length) - 1.0/ 7.0); }
 +                if (i % 3 == 0) { weight += fabs((test_lines[i] / length) - 3.0/14.0); }
 +                else            { weight += fabs((test_lines[i] / length) - 1.0/ 7.0); }
              }
  
              if(weight < eps_horizontal)