Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top