Monocular camera sensor driver
Sensor module, for camera configuration and image capture, etc., used to control the development board camera to complete the camera task.
1. Initialize the monocular camera
Reset and initialize the monocular camera
sensor.reset([freq=24000000, set_regs=True, dual_buff=False])
Parameter
freq: Set the camera clock frequency. The higher the frequency, the higher the frame rate, but the image quality may be worse. The default is 24MHz. If the camera has color spots (ov7740), you can adjust it down to 20MHz.
Set_regs: Allow the program to write to the camera registers. The default is True. If you need to customize the reset sequence, you can set it to False, and then use the sensor.__write_reg(addr, value) function to customize the write register sequence.
Dual_buff: Allow the use of double buffering, which will increase the frame rate, but the memory usage will also increase (about 384KiB)
2. Image capture control
Enable or disable the image capture function (by default, the camera will automatically start after resetting, setting the frame size, and setting the pixel format. Image acquisition will also start even if run(1) is not called)
sensor.run(enable)
Parameter
enable: 1 means enable, 0 means disable
Return value
return: return 1
3. Set frame size
Used to set the camera output frame size. The maximum supported frame size of k210 is VGA. If it is larger than VGA, the image cannot be obtained.
The screen resolution of the MaixPy development board is 320*240. It is recommended to set it to QVGA format
sensor.set_framesize(framesize[, set_regs=True])
Parameters
framesize: frame size
set_regs: Allows the program to write camera registers, the default is True. If you need to customize the sequence of setting the frame size, you can set it to False, and then use the sensor.__write_reg(addr, value) function to customize the write register sequence
Return value
True: Setting successful
False: Setting error
|