Python/OpenCV webcam movement backwards

I am not sure what the issue is but when I move around on the webcam it captures my face but it is not a mirror of my movements, it is backwards/inverted.

Does anyone know how to fix this?

def Webcam(webcam, classifier, downScale):

    if webcam.isOpened():
            rval, frame =
            rval = False

    while rval:
            # detect faces and draw bounding boxes
            minisize = (frame.shape[1]/downScale,frame.shape[0]/downScale)
            miniframe = cv2.resize(frame, minisize)
            faces = classifier.detectMultiScale(miniframe)
            for f in faces:
                    x, y, w, h = [ v*downScale for v in f ]
                    cv2.rectangle(frame, (x,y), (x+w,y+h), (0,0,255))

            cv2.putText(frame, "Press ESC to close.", (5, 25),
                                    cv2.FONT_HERSHEY_SIMPLEX, 1.0, (255,255,255))
            cv2.imshow("Face Crop", frame)

            # get next frame
            rval, frame =

            key = cv2.waitKey(10)
            if key in [27, ord('Q'), ord('q')]: # exit on ESC


a camera is not a mirror.

but you can easily flip() it to behave like a mirror:

rval, frame =
frame = cv2.flip(frame,1)

Need Your Help

C Programming: how to avoid code duplication without losing clarity

c code-duplication deduplication

edit: Thanks to all repliers. I should have mentioned in my original post that I am not allowed to change any of the specifications of these functions, so solutions using assertions and/or allowing...

PHP Regex (.*?) and callback \\1 JavaScript equivalent

javascript php html css regex

In PHP I have this (from previous question on my account):