Ask Your Question

Revision history [back]

The mousehandlers assigned to a namedWindow only work correct as long as the window is not larger than your main monitor. To solve your problem there are two possible solutions.

  1. Rescale images if they are over your screens resolution. Then use the scale factor to calculate the actual dimensions.
  2. Cut down your image into patches and just assing a storage of current point into a temp variable when clicking the image. Then use the two points to define the rectangle.

In order to split a givin image easily use:

Mat window = image( Rect(xWindow,yWindow,widthWindow,heigthWindow) );