title: How can I invert the cursor movement in python?
body: <p>In this code, I'm using Python 2.7.13, OpenCV 2.4.13 and PyAutoGUI 0.9.36. The objective is to move the cursor according to the facial movement, but the cursor movement is inverted. For example, if my face goes to right, the cursor moves to left and if my face goes to left, the cursor goes to right. Also, I want the cursor to move right, left, up and down in the whole screen of my PC, whose size is x=1920, y=1080. </p>
  
  <p>The purpose of this program  is to show that it is possible to get a new way to acquire more independence and access so that people with tetraplegia are capable of doing the simple activities, which are part of the routine of millions of individuals, such as turning the light on and off and turning TV on and off. </p>
  
  <pre><code>import cv2
  import pyautogui
  
  faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
  
  video_capture = cv2.VideoCapture(0)
  
  while True:
      # Capture frame-by-frame
      ret, frame = video_capture.read()
  
      gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
      faces = faceCascade.detectMultiScale(
          gray,
          scaleFactor=1.3,
          minNeighbors=5,
          minSize=(80, 80),
          flags=cv2.cv.CV_HAAR_SCALE_IMAGE
      )
  
      #print 'faces: ', faces
  
      # Draw a rectangle around the faces
      for (x, y, w, h) in faces:
          cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 0, 255), 3)
  
      #width, height = pyautogui.size()
      #cursorx, cursory = pyautogui.position()
      #posx = width - cursorx
      #posy = cursory
      pyautogui.moveTo(x+w, y+h)
  
      # Display the resulting frame
      #cv2.imshow('Video', frame)
      rimg = cv2.flip(frame,1) #invert the object frame
      cv2.imshow("vertical flip", rimg) 
  
      if cv2.waitKey(1) &amp; 0xFF == ord('q'):
          break
  # When everything is done, release the capture
  video_capture.release()
  cv2.destroyAllWindows()
  </code></pre>