質問

I am trying to resize my image equal to my source image so that i can further multiply or perform different other function for that i write the following code

Mat out = imread ("E:\\img1.jpg");
Mat img12=imread("D:\\image12");
img12.convertTo(img12 , out.type());
resize(img12,img12,out.size(),0,0,1);

But when i run this program in show me the error

Assertion failed (ssize.area() > 0 ) in unknown function

Where i am going wrong as i change the type too

役に立ちましたか?

解決

What format is image12, why has it no file ending? According to the documentation, it has to be one of the following:

  • Windows bitmaps - *.bmp, *.dib (always supported)
  • JPEG files - *.jpeg, *.jpg, *.jpe (see the Notes section)
  • JPEG 2000 files - *.jp2 (see the Notes section)
  • Portable Network Graphics - *.png (see the Notes section)
  • Portable image format - *.pbm, *.pgm, *.ppm (always supported)
  • Sun rasters - *.sr, *.ras (always supported)
  • TIFF files - *.tiff, *.tif (see the Notes section)

Furthermore the documentation states, that when an image cannot be read, imread returns an empty matrix. This could be the case in your problem.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top