From d76b976012cf47eb90720b1cd6a06fa664f20425 Mon Sep 17 00:00:00 2001 From: Aliaksandr Date: Tue, 2 Jun 2015 12:12:11 +0300 Subject: [PATCH] Bug fix for feature extraction According to CartToPolar() function documentation, result angles could be in range (0..360). To prevent index overflow this check is important. --- modules/xobjdetect/src/acffeature.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/xobjdetect/src/acffeature.cpp b/modules/xobjdetect/src/acffeature.cpp index 39afc9bdf..aac2601ef 100644 --- a/modules/xobjdetect/src/acffeature.cpp +++ b/modules/xobjdetect/src/acffeature.cpp @@ -307,6 +307,8 @@ void computeChannels(InputArray image, vector& channels) for (int col = 0; col < grad.cols; ++col) { //float angle = atan2(row_der(row, col), col_der(row, col)) * to_deg; float angle = angles(row, col); + if (angle > 180) + angle -= 180; if (angle < 0) angle += 180; int ind = (int)(angle / 30);