Skip to content

Commit e578cdb

Browse files
committed
Add method range check
Method can be only 0~5, if other number supply will default to TM_CCORR_NORMED.
1 parent a2a3018 commit e578cdb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Matrix.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,9 +2266,8 @@ NAN_METHOD(Matrix::MatchTemplateByMatrix) {
22662266
*/
22672267

22682268
int method = (info.Length() < 2) ? (int)cv::TM_CCORR_NORMED : info[1]->Uint32Value();
2269+
if (!(method >= 0 && method <= 5)) method = (int)cv::TM_CCORR_NORMED;
22692270
cv::matchTemplate(self->mat, templ->mat, m_out->mat, method);
2270-
cv::normalize(m_out->mat, m_out->mat, 0, 1, cv::NORM_MINMAX, -1, cv::Mat());
2271-
22722271
info.GetReturnValue().Set(out);
22732272
}
22742273

0 commit comments

Comments
 (0)