title: mouse handler in opencv for large images, wrong x,y coordinates?
body: <p>i am using images that are 2048 x 500 and when I use cvShowImage, I only see half the image. This is not a big deal because the interesting part is on the top half of the image. Now, when I use the mouseHandler to get the x,y coordinates of my clicks, I noticed that the coordinate for y (the dimension that doesnt fit in the screen) is wrong. </p>
  
  <p>It seems OpenCV think this is the whole image and recalibrates the coordinate system although we are only effectively showing half the image.</p>
  
  <p>I would need to know how to do 2 things:
  - display a resized image that would fit in the screen</p>
  
  <ul>
  <li>get the proper coordinate.</li>
  </ul>
  
  <p>Did anybody encounter similar problems?</p>
  
  <p>Thanks!</p>
  
  <p>Update: it seems the y coordinate is divided by 2 of what it is supposed to be</p>
  
  <p>code:</p>
  
  <pre><code>EXPORT void click_rect(uchar * the_img, int size_x, int size_y, int * points)
  {
  CvSize size;
  size.height = size_y ;
  size.width = size_x;
  
  IplImage * img;
  img = cvCreateImageHeader(size, IPL_DEPTH_8U, 1);
  img-&gt;imageData = (char *)the_img;
  img-&gt;imageDataOrigin = img-&gt;imageData;
  
  img1 = cvCreateImage(cvSize((int)((size.width)) , (int)((size.height)) ),IPL_DEPTH_8U, 1);
  
  cvNamedWindow("mainWin",CV_WINDOW_AUTOSIZE); 
  cvMoveWindow("mainWin", 100, 100);
  
  cvSetMouseCallback( "mainWin", mouseHandler_rect, NULL );
  
  cvShowImage("mainWin", img1 );
  
  //// wait for a key
  cvWaitKey(0);
  
  points[0] = x_1;
  points[1] = x_2;
  points[2] = y_1;
  points[3] = y_2;
  
  //// release the image
  cvDestroyWindow("mainWin");
  cvReleaseImage(&amp;img1 );
  cvReleaseImage(&amp;img);
  }
  </code></pre>