title: Click mouse and draw fixed rectangle at mouse position in Video (python_opencv)
body: <p>So during my webcam/video I would like to when I click my mouse, a rectangle is drawn at the mouse position, and the rectangle size is fixed ex. 80 X 80. In my current code, the rectangle follows the mouse but the size is always different. I want a fixed size exactly at the mouse position when I Click on a frame in the video. </p>
  
  <p>Here is my code. </p>
  
  <pre><code>import os
  import numpy as np
  import cv2 
  from PIL import Image
  import re
  
  
  
  print('kaishi')
  flag=0
  drawing = False
  
  point1 = ()
  point2 = ()
  ref_point = []
  xvalues=[];
  yvalues=[];
  ref_point = []
  
  
  cx=0;
  cy=0;
   def mouse_drawing(event, x, y, flags, params):
       global point1, point2, 
       drawing,ref_point2,flag,refPt,cropping,cx,cy
  
  
  
       if event == cv2.EVENT_LBUTTONDOWN:
  
          drawing = True
          point1 = (x, y)
          xvalues.append(x)
          yvalues.append(y)
          cx =x;
          cy=y;
  
  
  elif event == cv2.EVENT_MOUSEMOVE:
      if drawing is True:
          point2 = (x, y)
  
  
  
  
  elif event == cv2.EVENT_LBUTTONUP:
          flag+=1;
          print('finished square')
  
  
  
  
  
  cap = cv2.VideoCapture(0)
  
  cv2.namedWindow("Frame")
  cv2.setMouseCallback("Frame", mouse_drawing)
  
  
  while True:
     _, frame = cap.read()
  
        if point1 and point2 :
          cv2.rectangle(frame,(200,cy),(cx,128),(0,0,255),0)
          print(cx,cy)
  
          flag=0;
  
  
  
  
  
      cv2.imshow("Frame", frame)
  
  key = cv2.waitKey(25)
  if key== 13:
  
      print('done')
  
  
  
  
  elif key == 27:
       break
  
  
  
   cap.release()
   cv2.destroyAllWindows()
  </code></pre>