9. Read and Write Memory Card Experiment
Less than 1 minute
Routine Code
import sensor, image, time
sensor.reset() # Reset and initialize camera
sensor.set_pixformat(sensor.RGB565) # Set camera output format to RGB565 (GRAYSCALE also supported)
sensor.set_framesize(sensor.QVGA) # Set camera output size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Skip 2000 frames
clock = time.clock() # Create a clock object for FPS calculation
print("You're on camera!")
img = sensor.snapshot() # Capture an image
# Save image as JPG, BMP, or other formats
img.save("/sd/example.jpg") # or "example.bmp" (or others)
print("Done! Reset the camera to see the saved image.")Experiment Preparation
- Prepare a TF card and insert it into the K210.
- Connect the K210 to your computer via USB.
- Open CanMV IDE and run the routine code above.
Experiment Results
- After running, the K210 captures the camera feed and saves it to the TF card. On the TF card you will find
example.jpg—opening it shows the captured image.
- After running, the K210 captures the camera feed and saves it to the TF card. On the TF card you will find
Routine Code Explanation
Omitted. See comments in the routine code.