2016-10-17 3 views
-4

私はC++とOpenCVを使って画像を結合しようとしていますが、エラーが発生します。C++とOpenCVで画像を合成する

マイコード:

my code

エラー:

Assertion failed (size.width>0 && size.height>0) in imshow

the error

+6

貼り付けコードとエラー。スクリーンショットではありません。 – Chichi

+1

また、ロゴ画像もありますか? 'dota_log.png'という名前の画像を要求しました。それは 'dota_logo.png'でしょうか? – user1118321

+0

このエラーは、指定した入力イメージにアクセスできない場合によく発生します。 imshowに渡すMatがnullでないことを確認してください。 –

答えて

0

を意味することになってimread(..., 199)199は何ですか?

Valid values are

  • IMREAD_UNCHANGED If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).
  • IMREAD_GRAYSCALE If set, always convert image to the single channel grayscale image.
  • IMREAD_COLOR If set, always convert image to the 3 channel BGR color image.
  • IMREAD_ANYDEPTH If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.
  • IMREAD_ANYCOLOR If set, the image is read in any possible color format.
  • IMREAD_LOAD_GDAL If set, use the gdal driver for loading the image.
  • a few other options for reduced grayscale images.

通常は、BGRの画像をロードする:

Mat img = imread("/path/to/img.png"); // IMREAD_COLOR is default value 

またはグレースケールでのテキストとして問題になっている

Mat img = imread("/path/to/img.png", IMREAD_GRAYSCALE); 
関連する問題