# Revision history [back]

### setMouseCallback multiples rectangles

Dear all,

I am trying to show various fixed rectangles within a video flow, using the mouse. The fixed rectangle is set as follow within the onMouse function::

void onMouse(int event, int x, int y, int flags, void* param)
{
Rect rec = Rect(x, y, 100, 150);

if(event == EVENT_LBUTTONDOWN)
{
counter++;
}
}


So, when I move the mouse, I see the "rec" moving until I click down the left button. When a click is detected, I would like to show the ROI build within the main frame, and build outside the main frame my ROI through:

        roi1 = frame(rec);
imshow("Roi1", roi1);


The problem is that the ROI is frozen and doesn't show the real time roi frame. I need also to repeat the operation 3 times.

Could you help me to solve this problem ?

Thanks for your help and support.

Regards,

Christophe