0

I want to design an autonomous RC car using Raspberry Pi B+. To achieve this I have to collect training examples (images) and commands to drive the car autonomously. The problem is I send commands with 20ms period but the minimum time for capturing and saving an image requires about 470ms. So it makes raspberry to execute the commands slowly. Is there any method to make the process of capturing and saving image faster?


I've already seen answers like this.. But this makes only capturing process faster. My project requires saving image faster as well.

import picamera

################################

camera = picamera.PiCamera()
camera.resolution = (300,300)
camera.framerate = 80

index_of_image = 0
path = "/media/pi/WC-DRIVE/training_examples/"

def capture_image(command):
    global index_of_image
    camera.capture(path+str(index_of_image)+"- 
    "+str(command)+".jpg",'jpeg',use_video_port = True)
    index_of_image = index_of_image+1
  • Could you explain more about what you mean by "sending commands"? The code you give doesn't have anything to do with sending commands. A minimal, complete, verifiable example might be useful, or a better explanation. I have a few ideas, but it's hard to know what to suggest without understanding the problem better. As it stands, couldn't you just record video, which you should be able to do fast enough, and then post-process it into separate JPGs? If that's not suitable in your case, can you explain why please? – Mark Smith Mar 28 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.