Skip to content

Commit

Permalink
Add method range check
Browse files Browse the repository at this point in the history
Method can be only 0~5,  if other number supply will default to
TM_CCORR_NORMED.
  • Loading branch information
evilcat-x committed Jul 25, 2016
1 parent a2a3018 commit e578cdb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Matrix.cc
Expand Up @@ -2266,9 +2266,8 @@ NAN_METHOD(Matrix::MatchTemplateByMatrix) {
*/

int method = (info.Length() < 2) ? (int)cv::TM_CCORR_NORMED : info[1]->Uint32Value();
if (!(method >= 0 && method <= 5)) method = (int)cv::TM_CCORR_NORMED;
cv::matchTemplate(self->mat, templ->mat, m_out->mat, method);
cv::normalize(m_out->mat, m_out->mat, 0, 1, cv::NORM_MINMAX, -1, cv::Mat());

info.GetReturnValue().Set(out);
}

Expand Down

0 comments on commit e578cdb

Please sign in to comment.