Fix HoughLines crashes (Bug #3959).
Avoid phi exceed PI/2 to get the negative value of cos(phi).
This commit is contained in:
parent
da6898f758
commit
0692bf5f34
@ -303,7 +303,7 @@ HoughLinesSDiv( const Mat& img,
|
|||||||
ti1 < halftn; ti1++, phi += theta_it, phi1 += scale_factor )
|
ti1 < halftn; ti1++, phi += theta_it, phi1 += scale_factor )
|
||||||
{
|
{
|
||||||
rv = r0 * std::cos( phi );
|
rv = r0 * std::cos( phi );
|
||||||
i = cvFloor( rv ) * tn;
|
i = (int)rv * tn;
|
||||||
i += cvFloor( phi1 );
|
i += cvFloor( phi1 );
|
||||||
assert( i >= 0 );
|
assert( i >= 0 );
|
||||||
assert( i < rn * tn );
|
assert( i < rn * tn );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user