webcam image showing size problem

asked 2015-02-05 02:19:14 -0600

Hi, i`m using opencv on raspberry pi,I have a code written in python using opencv, code works fine in my ubuntu 14.04 but when i run it on raspberry pi the output is too small, this code detects faces in webcam

Here is the screenshot:image description

and this is the code i have got from here:

import cv2
import sys

cascPath = sys.argv[1]
faceCascade = cv2.CascadeClassifier(cascPath)

video_capture = cv2.VideoCapture(0)

while True:
    ret, frame = video_capture.read()

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    faces = faceCascade.detectMultiScale(
        gray,
        scaleFactor=1.1,
        minNeighbors=5,
        minSize=(30, 30),
        flags=cv2.cv.CV_HAAR_SCALE_IMAGE
    )

    for (x, y, w, h) in faces:
        cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 2)

    cv2.imshow('Video', frame)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

video_capture.release()
cv2.destroyAllWindows()

How can I fix it?

edit retag flag offensive close merge delete