1

I've been running my camera for nearly over a month now, with brief halting throughout the past month, but recently I noticed my picamera was not taking any pictures, I checked the script and it was failing at:

PiCameraValueError: Incorrect buffer length for resolution 128x80 

Here is my python 2.7 code:

testWidth = 128 testHeight = 80 def takeDayImage(imageWidth, imageHeight, filename): if verbose: print "takeDayImage - Working ....." with picamera.PiCamera() as camera: camera.resolution = (imageWidth, imageHeight) # camera.rotation = cameraRotate #Note use imageVFlip and imageHFlip variables if imagePreview: camera.start_preview() camera.vflip = imageVFlip camera.hflip = imageHFlip # Day Automatic Mode camera.exposure_mode = 'auto' camera.iso = dayISO camera.awb_mode = 'auto' camera.capture(filename) camera.led = True #False if verbose: print "takeDayImage - Captured %s" % (filename) camera.truncate(0) #added 07-30-17 return filename def motionDetection(): print "Scanning for Motion threshold=%i sensitivity=%i ......" % (threshold, sensitivity) print "Successfully loaded detectmotion.py" isDay = True currentCount= 1000 while True: if scanMotion(testWidth, testHeight, isDay): filename = getFileName(imagePath, imageNamePrefix, currentCount) if numberSequence: currentCount += 1 if isDay: takeDayImage( imageWidth, imageHeight, filename ) else: takeNightImage( imageWidth, imageHeight, filename ) 

I had read to call the .truncate() method and have implemented it, after researching this exact error (as stated above), but it still seems to be having this same error.

Can someone please help?

3
  • Have you tried changing the width and height to 1080x720 and then crop it? It could be that the camera has a minimum size. Commented Jul 31, 2017 at 9:49
  • @MathiasLindström tried that but the error changes then to: PiCameraValueError: Incorrect buffer length for resolution 1080x720 . any other thoughts? still stuck Commented Jul 31, 2017 at 23:06
  • Could you pastebin the whole code? Commented Aug 1, 2017 at 20:39

1 Answer 1

1

Your problem seems to be:

imageDir = "westmontavecamimage" imagePath = "/media/pi/StoyAveCamStorag/" + imageDir 

Does a great job on my Pi. You could check if Python has read/write rights if that doesn't solve the problem for you.

2
  • how does thus present a problem? the full path of imagePath doesnt end with / Commented Aug 3, 2017 at 21:02
  • @Jshee: If the path isn't correct. It won't be able to save the pictures. Commented Aug 4, 2017 at 8:54

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.