0

I have a CAM500B OV5640 camera connected to a NanoPi NEO Air board. When using the mjpg-streamer demo that comes with the board, the camera output looks correct. However when trying to take a still picture using OpenCV in Python, the image output looks like a line of pixels stretched vertically.

#!/usr/bin/env python
""" Simple camera interface. """
import cv2
import time

if __name__ == "__main__":
    cap = cv2.VideoCapture(0)
    if not cap.isOpened():
        print "Failed to create capture object."
        quit(-1)

    cap.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH,1280)
    cap.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT,720)
    #cap.set(cv2.cv.CV_CAP_PROP_FORMAT, cv2.cv.IPL_DEPTH_32F)

    print "Ramping camera..."
    for i in xrange(0, 30):
        _, image = cap.read()

    cv2.imwrite("test.jpg", image)
    cap.release()
    print "Done."
eyllanesc
  • 235,170
  • 19
  • 170
  • 241

0 Answers0