- fix possible crash introduced by cvRound

This commit is contained in:
Vincent Rabaud 2011-05-23 20:03:16 +00:00
parent 72728b4481
commit 974799acd8

View File

@ -388,7 +388,8 @@ public:
private:
static inline int angle2Wedge(float angle)
{
return cvRound((angle / 360) * kNumAngles);
static float scale = float(kNumAngles) / 360.0f;
return std::min(int(std::floor(angle * scale)), kNumAngles - 1);
}
void generateRelativePattern(int angle_idx, int /*sz*/, cv::Mat & relative_pattern)