buildPyramid infintely loops with an empty image (Bug #3094)


Added by Vincent Rabaud over 11 years ago. Updated over 11 years ago.


Status:Done Start date:2013-06-17
Priority:Normal Due date:
Assignee:Dmitry Retinskiy % Done:

0%

Category:imgproc, video
Target version:2.4.7
Affected version:2.4.6 (latest release) Operating System:Windows
Difficulty:Easy HW Platform:x86
Pull request:https://github.com/Itseez/opencv/pull/1270

Description

Just do the following:

    std::vector<cv::Mat> foo;
    cv::buildPyramid(cv::Mat(), foo, 4);

I tracked it down to pyrDown_: I believe the "limit" variable in there can be set to 0 (for an empty matrix), thus leading to for( ; x < limit; x++ ) looping forever.

I am not sure of what the proper behavior is: should there be an assert ? or should it return an empty matrix ? Just let me know and I'll patch it.


Associated revisions

Revision 4eb85189
Added by Dmitry Retinskiy over 11 years ago

bug #3094: added CV_Assert to PyrDown_ to check if source matrix is not empty

Revision 5f590ebe
Added by Vadim Pisarevsky over 10 years ago

Merge pull request #3094 from Adil-Ibragimov:minor_fixes_in_Mat-data

History

Updated by Kirill Kornyakov over 11 years ago

IMO there should be an assert, since I can't imagine a situation, when user wants to build a pyramid from empty image. So, most likely we should fail, so user immediately gets informed and manually processes this corner case. Silent generation of a pyramid with empty images will likely result in exhausting debugging session... But I might be wrong, so we should probably ask Vadim.

  • Description changed from Just do the following: std::vector<cv::Mat> foot; cv::buildPyra... to Just do the following: <pre> std::vector<cv::Mat> foot; c... More
  • Category set to imgproc, video
  • Operating System set to Windows
  • HW Platform set to x86
  • Difficulty set to Easy

Updated by Dmitry Retinskiy over 11 years ago

  • Assignee set to Dmitry Retinskiy
  • Affected version changed from 2.4.5 (latest release) to branch '2.4'

Updated by Dmitry Retinskiy over 11 years ago

  • Affected version changed from branch '2.4' to 2.4.6 (latest release)

Updated by Dmitry Retinskiy over 11 years ago

  • Pull request set to https://github.com/Itseez/opencv/pull/1270
  • Description changed from Just do the following: <pre> std::vector<cv::Mat> foot; c... to Just do the following: <pre> std::vector<cv::Mat> foo; cv... More

Updated by Sergei Nosov over 11 years ago

  • Status changed from Open to Done

Updated by Dmitry Retinskiy over 11 years ago

  • Target version set to 2.4.7

Also available in: Atom PDF