PiCapture "Static" in preview window when using python picamera

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #940
    Henry
    Participant

    from the command line, I type:
    raspivid -md 6 -p 50,50,320,240
    and get a nice preview window

    when I attempt to do this in python:

    import time
    import picamera
    
    camera = picamera.PiCamera(sensor_mode=6)
    camera.start_preview(fullscreen=False, window = (20,20,320,240))
    time.sleep(10)
    camera.stop_preview()

    I get static surrounding the video.

    Any ideas?

    #941
    Henry
    Participant

    here’s the missing python code:
    `import time
    import picamera

    camera = picamera.PiCamera(sensor_mode=6)
    camera.start_preview(fullscreen=False, window = (20,20,320,240))
    time.sleep(10)
    camera.stop_preview()

    #942
    Henry
    Participant

    I found that the fix in the thread “Using Python picamera and opencv” worked for me as well.

    The solution was to add camera.framerate=60 following the instantiation of the camera object.

    #943
    mwlinder
    Keymaster

    Great – thanks for letting us know. I was just in the process of trying to reproduce the problem!

    One other thing I found in the past with picamera is that sometimes it has issues if you don’t set the resolution along with the camera mode. It shouldn’t matter, but it doesn’t hurt to use:
    camera=picamera.PiCamera(sensor_mode = 6, resolution=(640,480))
    rather than just setting the sensor_mode.

    Depending on the video you are capturing, you might consider turning off the exposure control and automatic white balance functions:
    camera.exposure_mode = ‘off’
    camera.awb_mode = ‘off’
    camera.awb_gains = (1.0,1.0)

    #1433
    Anonymous
    Inactive

    Actually, i had the same problem as well. But i did not use that solution to fix the problem, rather it was somewhat an embarrasing reason for why my picture kept have these filler noises. I had written the code and without noticing it, ran it through an earlier version of IDLE (2.x). As soon as i ran it on IDLE3, the filler noise and every other problem solved by itself.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Henry"Static" in preview window when using python picamera