title: display multiple images in single window OPENCV
body: <p>I found this code on the internet, and it seems it works fine with others. But I always get something like this: 
  Unhandled exception at 0x012c1073 in examplexx.exe: 0xC0000005: Access violation reading location 0x00000028.</p>
  
  <p>Have anybody idea what might be a problem?  </p>
  
  <pre><code>#include &lt;opencv2/imgproc/imgproc.hpp&gt;  
  #include &lt;opencv2/core/core.hpp&gt;        
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;iostream&gt;
  
  
  using namespace cv;
  using namespace std;
  
  int main()
  {
  //Image Reading
  IplImage* img1 = cvLoadImage( "ball.jpg" );
  IplImage* img2 = cvLoadImage( "ball.jpg" );
  IplImage* img3 = cvLoadImage( "ball.jpg" );
  IplImage* img4 = cvLoadImage( "ball.jpg" );
  
  int dstWidth=img1-&gt;width+img1-&gt;width;
  int dstHeight=img1-&gt;height+img1-&gt;height;
  
  IplImage* dst=cvCreateImage(cvSize(dstWidth,dstHeight),IPL_DEPTH_8U,3); 
  
  // Copy first image to dst
  cvSetImageROI(dst, cvRect(0, 0,img1-&gt;width,img1-&gt;height) );
  cvCopy(img1,dst,NULL);
  cvResetImageROI(dst);
  
  // Copy second image to dst
  cvSetImageROI(dst, cvRect(img2-&gt;width, 0,img2-&gt;width,img2-&gt;height) );
  cvCopy(img2,dst,NULL);
  cvResetImageROI(dst);
  
  // Copy third image to dst
  cvSetImageROI(dst, cvRect(0, img3-&gt;height,img3-&gt;width,img3-&gt;height) );
  cvCopy(img3,dst,NULL);
  cvResetImageROI(dst);
  
  // Copy fourth image to dst
  cvSetImageROI(dst, cvRect(img4-&gt;width, img4-&gt;height,img4-&gt;width,img4-&gt;height));
  cvCopy(img4,dst,NULL);
  cvResetImageROI(dst);
  
  //show all in a single window
  cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
  cvShowImage( "Example1", dst );
  cvWaitKey(0);
  
  }
  </code></pre>