Bug: matchTemplate() returns a -1 value with CV_TM_SQDIFF (ver 2.3.4) (Bug #2679)


Added by Adi Shavit about 12 years ago. Updated about 12 years ago.


Status:Done Start date:2013-01-05
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:imgproc, video
Target version:2.4.4
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:https://github.com/Itseez/opencv/pull/280

Description

I'm getting some very strange behaviour (OpenCV ver 2.3.4): matchTemplate() returns a -1 value with CV_TM_SQDIFF.
How can a square be negative?

Here's the code:

   {
      cv::Mat templ = imread("template.png");
      cv::Mat img   = imread("img.png");
      cv::Mat matchRes    ;

      cv::matchTemplate(img, templ, matchRes, CV_TM_SQDIFF);

      double best;
      cv::minMaxLoc(matchRes, &best);// best should NOT be -1
   }

The offending images are attached.


img.png (121.6 kB) Adi Shavit, 2013-01-05 08:26 pm

template.png (492 Bytes) Adi Shavit, 2013-01-05 08:26 pm


Associated revisions

Revision 07d5f567
Added by Alexander Alekhin almost 11 years ago

Merge pull request #2679 from alalek:ippicv_update

History

Updated by Kirill Kornyakov about 12 years ago

  • Pull request set to https://github.com/Itseez/opencv/pull/280
  • Target version set to 2.4.4

Updated by Andrey Kamaev about 12 years ago

Fix is pushed to 2.4

  • Status changed from Open to Done

Also available in: Atom PDF