|
|
@ -11,8 +11,8 @@ from picamera import PiCamera
|
|
|
|
p = ArgumentParser("")
|
|
|
|
p = ArgumentParser("")
|
|
|
|
p.add_argument("--video", type=int, default=0, help="video, default: 0")
|
|
|
|
p.add_argument("--video", type=int, default=0, help="video, default: 0")
|
|
|
|
p.add_argument("--output", default=None, help="path to save movie, default: None (show live)")
|
|
|
|
p.add_argument("--output", default=None, help="path to save movie, default: None (show live)")
|
|
|
|
p.add_argument("--width", type=int, default=640, help="pre-detect resize width")
|
|
|
|
p.add_argument("--width", type=int, default=160, help="pre-detect resize width")
|
|
|
|
p.add_argument("--height", type=int, default=480, help="pre-detect resize height")
|
|
|
|
p.add_argument("--height", type=int, default=128, help="pre-detect resize height")
|
|
|
|
p.add_argument("--fourcc", default="XVID", help="MJPG,mp4v,XVID")
|
|
|
|
p.add_argument("--fourcc", default="XVID", help="MJPG,mp4v,XVID")
|
|
|
|
p.add_argument("--framerate", type=float, default=25, help="output frame rate")
|
|
|
|
p.add_argument("--framerate", type=float, default=25, help="output frame rate")
|
|
|
|
p.add_argument("--show", default=False, action="store_true")
|
|
|
|
p.add_argument("--show", default=False, action="store_true")
|
|
|
@ -20,9 +20,9 @@ p.add_argument("--frames", type=int, default=100)
|
|
|
|
args = p.parse_args()
|
|
|
|
args = p.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
fourcc = None
|
|
|
|
fourcc = None
|
|
|
|
cam = cv2.VideoCapture(args.video)
|
|
|
|
#cam = cv2.VideoCapture(args.video)
|
|
|
|
cam.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, args.width)
|
|
|
|
#cam.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, args.width)
|
|
|
|
cam.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, args.height)
|
|
|
|
#cam.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, args.height)
|
|
|
|
|
|
|
|
|
|
|
|
if args.output:
|
|
|
|
if args.output:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -36,7 +36,7 @@ else:
|
|
|
|
|
|
|
|
|
|
|
|
print ("Starting camera", file=sys.stderr)
|
|
|
|
print ("Starting camera", file=sys.stderr)
|
|
|
|
cam = PiCamera()
|
|
|
|
cam = PiCamera()
|
|
|
|
framesize = (160, 128)
|
|
|
|
framesize = (args.width, args.height)
|
|
|
|
cam.resolution = framesize
|
|
|
|
cam.resolution = framesize
|
|
|
|
cam.framerate = 32
|
|
|
|
cam.framerate = 32
|
|
|
|
rawCapture = PiRGBArray(cam, size=framesize)
|
|
|
|
rawCapture = PiRGBArray(cam, size=framesize)
|
|
|
|