imgwarp-opencv icon indicating copy to clipboard operation
imgwarp-opencv copied to clipboard

Divide by zero

Open Fogrunner opened this issue 2 years ago • 2 comments

Hello.

First for all, thanks for sharing great code.

I have found some memory crashing case.

When i put the same zero control point , some code makes crashing.

// 2 zero points
qsrc.push_back(cv::Point_<int>(0, 0));
qsrc.push_back(cv::Point_<int>(0, 0));

// 2 zero points
qdst.push_back(cv::Point_<int>(0, 0));
qdst.push_back(cv::Point_<int>(0, 0));

In imgwarp_mls_rigid.cpp

tmpP *= w[k] / miu_r;

Above code makes dividing by zero without handling.

Fogrunner avatar Sep 27 '22 07:09 Fogrunner

It seems to happen when i put control points which have the same values.

Fogrunner avatar Sep 27 '22 07:09 Fogrunner

Thanks for debugging! Please feel free to send a PR. Thanks!

Fogrunner @.***>于2022年9月27日 周二上午12:40写道:

It seems to happen when i put control points in the same location.

— Reply to this email directly, view it on GitHub https://github.com/cxcxcxcx/imgwarp-opencv/issues/11#issuecomment-1259110037, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABZUDEAHQT3SDQ2MJ5COHLWAKQF5ANCNFSM6AAAAAAQWPD7TA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Sent from Gmail Mobile

cxcxcxcx avatar Oct 09 '22 15:10 cxcxcxcx