About Saving Sony Spresense Image Data to an SD Card

Asked 2 years ago, Updated 2 years ago, 48 views

I use the camera module and camera.ino to record images on the SD card, but I can only save about 2 frames per second.Please tell me how to make it possible to record on an SD card at about 30 FPS.Thank you for your cooperation.

spresense

2022-09-30 13:48

1 Answers

I was interested, so I looked into it a little bit.
When I looked into the time taken to take a still image of caemra.ino, the breakdown was as follows:

takePicture: 330ms ~ 
OpenFile—30 ms
WriteFile: 70 ms ~
CloseFile: 10 ms
Total: 440 ms ~
*Please note that it may vary depending on the file size of the JPG taken.

It takes 330 ms for still image shooting and 110 ms for file processing.

When I looked at the contents of takePicture, I was wondering why it took so long to take still pictures.

ioctl(video_fd, VIDIOC_TAKEPICT_START, take_num)// Camera Start
ioctl_dequeue_stream_buf(&buf, V4L2_BUF_TYPE_STILL_CAPTURE) // Photo shoot
ioctl(video_fd, VIDIOC_TAKEPICT_STOP, false) // Camera Stopped

In other words, every time I took a still picture, I started and stopped the camera.

So I thought what would happen if I started the camera and took pictures continuously, so I tried it.
Here's what it looks like:

ioctl(video_fd, VIDIOC_TAKEPICT_START, take_num)// Camera Start
for(inti=0;i<30;++i){
  ioctl_dequeue_stream_buf(&buf, V4L2_BUF_TYPE_STILL_CAPTURE) // 30 consecutive photoshoots
}
ioctl(video_fd, VIDIOC_TAKEPICT_STOP, false) // Camera Stopped

The measurement results are as follows:

ioctl_dequeue_stream_buf:90ms ~ 
OpenFile—30 ms
WriteFile: 70 ms ~
CloseFile: 10 ms
Total: 200 ms ~
*Please note that it may vary depending on the file size of the JPG taken.

As I expected, the time has shrunk a lot. I think I can manage about 5fps.

However, to achieve 30 fps, only 15 ms is allocated for still image shooting and 15 ms for file processing.Well, it seems difficult to achieve 30fps based on the processing of still images.

The total amount of data will be reduced due to the time-direction compression of the video, and the SD card can be written continuously, so it may be faster, but unfortunately, I couldn't find any code to help you.

I hope this is helpful. (It may not be very helpful, but…^^;)


2022-09-30 13:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.