findTransformECC iterations do not converge

asked 2020-05-25 09:30:07 -0600

larrydong gravatar image

When I using findTransformECC, and I provide an initial warping matrix. But the program is down when the iteration not converge.

OpenCV Error: Iterations do not converge (the algorithm stopped before its convergence...) in findTransformECC ,

Can I just ignore the error and return a not converged flag? Why this funcion is designed to crash when not converged? I think it's not friendly.

edit retag flag offensive close merge delete

Comments

1

Can you add reproducible code and data?

I think you should be able to wrap the call in try / catch to catch the exception.

Eduardo gravatar imageEduardo ( 2020-05-25 17:56:31 -0600 )edit

Yes, the program always failed when the initial warp parameter is not good. try/catch can fix this problem. But I still wonder why OpenCV won't just return the status like "calcOpticalFlowPyrLK". Thanks for your reply.

larrydong gravatar imagelarrydong ( 2020-05-25 19:56:30 -0600 )edit

It was integrated like this.

If you think there is an issue with findTransformECC not converging (not because of too far initial values but rather an implementation issue in the method), feel free to add the reproducible data and code.

The method uses most likely a non-linear optimization approach. So if the initial guess is too far, the method can converge to a local minima I guess.

Eduardo gravatar imageEduardo ( 2020-05-26 14:08:20 -0600 )edit