2017-09-29 34 views
0

我遇到了一點麻煩minMaxLoc,當我嘗試通過點作爲參考,以獲得max_Loc即時通訊錯誤。環顧四周後,我發現了許多人使用double而不是point的例子,但在這裏並不是這樣。minMaxLoc()opencv drama

下面的代碼:

int ImageEvaluator::findPot() 
{ 
    Point max_Loc; 
    double max_Val; 
    while (true) 
    { 
     for (int j = 0; j < 12; j++) 
     { 

      cv::Mat compResult; 
      cv::matchTemplate(references[7], templates[7][j], compResult, 
           CV_TM_CCOEFF_NORMED); 
      cv::minMaxLoc(compResult, NULL, &max_Val, NULL, &max_Loc); 

      if (max_Val > minAcceptableValue) 
      { 
       std::cout << "Stand up and shout how the **** did that just work" << std::endl; 
       return joydivision; 
      } 
     } 
    } 
} 

錯誤C2665「CV :: minMaxLoc」:沒有2個重載可以轉換所有的參數類型

這是查找aload數字的小功能,我在python中工作得很好。只要我轉向C++,它就會以上面不想要的錯誤的形式走下坡路。

所有幫助表示讚賞。

感謝

+1

首先,我會建議規範化'compResult',然後試圖查看它只是爲了確保'matchTemplate()'結果是預期的。如果您使用['minMaxIdx()'](http://docs.opencv.org/3.2.0/d2/de8/group__core__array.html#ga7622c466c628a75d9ed008b42250a73f),您會得到正確的線性索引嗎? –

回答

1

大家好撓頭的aload後,事實證明,我被錯誤地宣佈我的觀點。

變化後:

Point max_Loc; 

分爲:

cv::Point min_Loc(0,0),max_Loc(0,0); 

似乎已經奏效。感謝您的幫助大聲笑。 :)