title: openCv crop image
body: <p>I running into problems with my openCv IplImage cropping. Assuming both tmp and img are IplImage* . Using the code: </p>
  
  <pre><code>printf("Orig dimensions: %dx%d\n", img-&gt;width, img-&gt;height);
  cvSetImageROI(img, cvRect(0, 0,500,500));
  tmp = cvCreateImage(cvGetSize(img),img-&gt;depth,img-&gt;nChannels);
  cvCopy(img, tmp, NULL);
  cvResetImageROI(img);
  img = cvCloneImage(tmp);
  printf("Orig dimensions after crop: %dx%d\n", tmp-&gt;width, tmp-&gt;height);
  </code></pre>
  
  <p>when I use the the cvRect above I'll get an image cropped with a size of 500 x500 as expected, however when i use the rect (400,400,500,500) I'll get an image with the size 500 X 320. </p>