5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OpenCV バグ cv::findContours() で std::vector<std::vector<cv::Point> > を使用してはいけない。

Last updated at Posted at 2014-12-06

報告済みのバグ Bad C-Cast on matrix.cpp about _InputArray (Bug #4050)

以下のコードは Windows 64bit 環境でdebugビルドをするとアサーションフェイルになる。

cv::Mat image = someImage();
std::vector<std::vector<cv::Point> > contours;
cv::findContours(image, contours,  CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);

cv::_InputArray の実装が糞なのが原因。

対処としては出力に std::vector<cv::Mat> を使用すること。

おそらく std::vector<T> を許容する cv::_OutputArray を用いた関数すべてで発生する問題。

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?