mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 11:21:39 +08:00
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.
This commit is contained in:
@@ -307,6 +307,8 @@ void computeChannels(InputArray image, vector<Mat>& channels)
|
|||||||
for (int col = 0; col < grad.cols; ++col) {
|
for (int col = 0; col < grad.cols; ++col) {
|
||||||
//float angle = atan2(row_der(row, col), col_der(row, col)) * to_deg;
|
//float angle = atan2(row_der(row, col), col_der(row, col)) * to_deg;
|
||||||
float angle = angles(row, col);
|
float angle = angles(row, col);
|
||||||
|
if (angle > 180)
|
||||||
|
angle -= 180;
|
||||||
if (angle < 0)
|
if (angle < 0)
|
||||||
angle += 180;
|
angle += 180;
|
||||||
int ind = (int)(angle / 30);
|
int ind = (int)(angle / 30);
|
||||||
|
Reference in New Issue
Block a user