-4
私はC++とOpenCVを使って画像を結合しようとしていますが、エラーが発生します。C++とOpenCVで画像を合成する
マイコード:
エラー:
Assertion failed (size.width>0 && size.height>0) in imshow
私はC++とOpenCVを使って画像を結合しようとしていますが、エラーが発生します。C++とOpenCVで画像を合成する
マイコード:
エラー:
Assertion failed (size.width>0 && size.height>0) in imshow
を意味することになってimread(..., 199)
で199
は何ですか?
- 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);
貼り付けコードとエラー。スクリーンショットではありません。 – Chichi
また、ロゴ画像もありますか? 'dota_log.png'という名前の画像を要求しました。それは 'dota_logo.png'でしょうか? – user1118321
このエラーは、指定した入力イメージにアクセスできない場合によく発生します。 imshowに渡すMatがnullでないことを確認してください。 –