title: C++, OpenCV : Assertion failed in Resize
body: <p>As a C++ beginner, I am currently facing a problem I somehow can't solve, even if the code is pretty simple.
  I've been searching for <a href="http://answers.opencv.org/question/2018/resizing-an-image/" rel="nofollow noreferrer">answers</a> all over the Internet, but none was applicable for my problem.</p>
  
  <p>I am currently coding basic SVMs with C++, under VS2013, using OpenCV 2.4.8.
  I was able to work on images of same size, specifying fixed height, width at the beginning of my code. </p>
  
  <p>Now, I'm trying to : open images of different sizes, resize them to a certain lower size, and apply the previous code to the now-resized dataset. Simple as that.</p>
  
  <p>Here's the beginning of my code :</p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;opencv2/imgproc/imgproc.hpp&gt;
  #include &lt;opencv2/ml/ml.hpp&gt;
  #include &lt;iostream&gt;
  #include &lt;math.h&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include &lt;sstream&gt;
  #include &lt;windows.h&gt;
  
  using namespace cv;
  using namespace std;
  
  int main(){
  </code></pre>
  
  <p>Input parameters are :</p>
  
  <pre><code>int Nb_Data_Class_1 = 10;
  int Nb_Data_Class_0 = 5;
  int Height_Zone = 200;
  int Width_Zone = 200;
  </code></pre>
  
  <p>so I will resize all my files to 200x200 format.</p>
  
  <pre><code>string Path = "C:\\Users\\....";
  string Format = ".jpg";
  
  int Nb_Files = Nb_Data_Class_1 + Nb_Data_Class_0;
  Mat TrainingMat(Nb_Files, Zone_Image, CV_32FC1);
  Mat TrainingLabels(Nb_Files, 1, CV_32FC1);
  </code></pre>
  
  <p>For every file of the class labelled {1} - they are all named Tree01, Tree02, etc. - I open, and resize.</p>
  
  <pre><code>for (int i = 0; i &lt; Nb_Data_Class_1; ++i)
  {
      stringstream ss;
      ss &lt;&lt; Path &lt;&lt; "\\Tree0" &lt;&lt; i + 1 &lt;&lt; Format;
      Mat Image = cv::imread(ss.str(), 0);
      resize(Image, Image, Size(Width_Zone, Height_Zone));}
  </code></pre>
  
  <p>Things worked perfectly without the last line. I had a Mat array, filled with 0-t0-255 numbers. Now, I get the following error :</p>
  
  <pre><code>OpenCV Error: Assertion failed &lt;ssize.area&lt;&gt; &gt;0&gt; in cv::resize, 
      file C:\builds\2-4-PackSlave-win32-vc12-shared\opencv\modules\imgproc\serc\imgwarp.cpp, line 1824
  </code></pre>
  
  <p>What could be the problem ?
  I thought that maybe OpenCV wasn't properly opening the files ; but, in that case, how everything could have been previously working ?
  Still wondering.</p>
  
  <p>Any help would be much appreciated ! Thanks in advance.</p>