mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Add method range check
Method can be only 0~5, if other number supply will default to TM_CCORR_NORMED.
This commit is contained in:
parent
a2a3018213
commit
e578cdb869
@ -2266,9 +2266,8 @@ NAN_METHOD(Matrix::MatchTemplateByMatrix) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int method = (info.Length() < 2) ? (int)cv::TM_CCORR_NORMED : info[1]->Uint32Value();
|
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::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);
|
info.GetReturnValue().Set(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user