2016-10-17 3 views
-4

Ich versuche C++ und OpenCV zu verwenden, um Bilder zu kombinieren, aber ein Fehler tritt auf.Kombinieren von Bildern mit C++ und OpenCV

Mein Code:

my code

Der Fehler:

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

the error

+6

Paste Code und Fehler in Frage als Text. Kein Screenshot – Chichi

+1

Sind Sie sicher, dass das Logobild vorhanden ist? Sie haben nach einem Bild mit dem Namen 'dota_log.png' gefragt. Sollte es "dota_logo.png" sein? – user1118321

+0

Dieser Fehler tritt häufig auf, wenn auf das von Ihnen angegebene Eingabebild nicht zugegriffen werden kann. Überprüfen Sie, ob die Mat, die Sie an imshow übergeben, nicht null ist –

Antwort

0

Was ist der 199 in imread(..., 199) bedeuten soll?

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.

Normalerweise möchten Sie das Bild in der BGR laden:

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

oder in Graustufen

Mat img = imread("/path/to/img.png", IMREAD_GRAYSCALE); 
Verwandte Themen