mjs513
Senior Member+
@KurtE and I have been at it again. This time creating a library that supports a number Arducam/Arduino camera modules:
Supported commands do vary from camera module to camera module:
Image capture is similar to what was done with the Teensy HM01B0 library:
1. GPIO
2. FLEXIO2 which supports DMA transfer
Double buffers have been tested for Framesizes up to VGA. If using the OV2640 JPEG images can be displayed up to SVGA and UXGA can be saved to SDCARD. Some modules support Windowing function which allows a smaller portion of the image to be displayed. See table above.
Currently the library has only been tested with the Teensy Micromod board but we will be testing with the Teensy 4.1 which supports PSRAM modules.
If anyone is interested they can check the library: https://github.com/mjs513/TeensyMM_Camera
This is still a work in progress so be warned. We have tried documenting as much as we could and a few extensive examples are available. The library is inspired from the Arduino GIGA Camera library, the ESP32 Camera library and the OpenMV project.
This is a quick overview and sure @KurtE will add more info and will be posting additional info in future threads
Model | FrameSizes | Pixel Formats | |
Omnivision OV2640 | FRAMESIZE_VGA //640x480 FRAMESIZE_QQVGA, // 160x120 FRAMESIZE_QVGA, // 320x240 FRAMESIZE_QCIF, // 176x144 FRAMESIZE_CIF, // 352x288 FRAMESIZE_SVGA, //800, 600 FRAMESIZE_UXGA, //1500, 1200 | YUV422, RGB565 BAYER GRAYSCALE JPEG | |
| FRAMESIZE_VGA //640x480 FRAMESIZE_QQVGA, // 160x120 FRAMESIZE_QVGA, // 320x240 FRAMESIZE_QCIF, // 176x144 FRAMESIZE_CIF, // 352x288 | YUV422, RGB565 BAYER GRAYSCALE | |
Omnivision OV7675 | FRAMESIZE_VGA //640x480 FRAMESIZE_QQVGA, // 160x120 FRAMESIZE_QVGA, // 320x240 FRAMESIZE_QCIF, // 176x144 FRAMESIZE_CIF, // 352x288 | YUV422, RGB565 BAYER GRAYSCALE | |
GalaxyCore GC2145 | {640, 480}, /* VGA */ {160, 120}, /* QQVGA */ {320, 240}, /* QVGA */ {480, 320}, /* ILI9488 */ {320, 320}, /* 320x320 */ {320, 240}, /* QVGA */ {176, 144}, /* QCIF */ {352, 288}, /* CIF */ {800, 600}, /* SVGA */ {1600, 1200}, /* UXGA */ | YUV422, RGB565 BAYER GRAYSCALE | |
Himax HM0B01 | FRAMESIZE_320X320 FRAMESIZE_QVGA FRAMESIZE_QQVGA FRAMESIZE_QVGA4BIT (same as QVGA) | Grayscale | |
Himax HM0360 | FRAMESIZE_320X320 FRAMESIZE_QVGA FRAMESIZE_QQVGA FRAMESIZE_QVGA4BIT (same as QVGA) | Grayscale |
Supported commands do vary from camera module to camera module:
OV2640 | OV767X | GC2145 | HB01B0 | HM0360 |
bool begin_omnivision(framesize_t resolution, pixformat_t format, int fps, int camera_name, bool use_gpio); | bool begin_omnivision(framesize_t resolution = FRAMESIZE_QVGA, pixformat_t format = RGB565, int fps = 30, int camera_name = OV7670, bool use_gpio = false); // Supported FPS: 1, 5, 10, 15, 30 | bool begin_omnivision(framesize_t resolution = FRAMESIZE_QVGA, pixformat_t format = RGB565, int fps = 30, int camera_name = OV7670, bool use_gpio = false); | bool begin(framesize_t framesize = FRAMESIZE_QVGA, int framerate = 30, bool use_gpio = false); | bool begin(framesize_t framesize = FRAMESIZE_QVGA, int framerate = 30, bool use_gpio = false); |
void end(); | void end(); | void end(); | void end(); | |
uint16_t getModelid(); | uint16_t getModelid(); | uint16_t getModelid(); | uint16_t getModelid(); | uint16_t getModelid(); |
int reset(); | int reset(); | int reset(); | int reset(); | |
void showRegisters(); | void showRegisters(); | void showRegisters(void); | void showRegisters(void); | |
int setPixformat(pixformat_t pixformat); | int setPixelFormat(pixformat_t pixformat); | int setPixformat( pixformat_t pfmt); | int setPixformat(pixformat_t pfmt); | |
uint8_t setFramesize(framesize_t framesize); | uint8_t setFramesize(framesize_t framesize); | uint8_t setFramesize(framesize_t framesize); | uint8_t setFramesize(framesize_t framesize); | |
uint8_t setFramesize(int w, int h); | uint8_t setFramesize(int w, int h); | |||
bool setZoomWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h); | bool setZoomWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h); | |||
int setFramerate(int framerate); | ||||
int setHmirror(int enable); | int setHmirror(int enable); | int setHmirror(int enable); | int setHmirror(int enable); | int setHmirror(int enable); |
int setVflip(int enable); | int setVflip(int enable); | int setVflip(int enable); | int setVflip( int enable); | int setVflip(int enable); |
int setAutoExposure(int enable, int exposure_us); | int setAutoExposure(int enable, int exposure_us); | int setAutoExposure(int enable, int exposure_us); | int setAutoExposure(int enable, int exposure_us); | |
int setBrightness(int level); | int setBrightness(int brightness); // 0 - 255 | int setBrightness(int level); | int setBrightness(int level); | |
void setSaturation( int level); | void setSaturation(int saturation); // 0 - 255 | |||
void setContrast(int level); | void setContrast(int contrast); // 0 - 127 | |||
void setHue(int hue); // -180 - 180 | ||||
int setWBmode(int mode); | ||||
int setSpecialEffect(sde_t sde); | ||||
int setGainceiling(gainceiling_t gainceiling); | int setGainceiling(gainceiling_t gainceiling); | int setGainceiling(gainceiling_t gainceiling); | ||
int setColorbar(int enable); | void testPattern(int pattern = 2); | int setColorbar(int enable); | int setColorbar(int enable); | int setColorbar(int enable); |
void noTestPattern(); | ||||
int setAutoGain( int enable, float gain_db, float gain_db_ceiling); | void autoGain(int enable, float gain_db, float gain_db_ceiling); | int setAutoGain(int enable, float gain_db, float gain_db_ceiling); | int setAutoGain(int enable, float gain_db, float gain_db_ceiling); | |
int setAutoWhitebal(int enable, float r_gain_db, float g_gain_db, float b_gain_db); | int setAutoWhitebal(int enable, float r_gain_db, float g_gain_db, float b_gain_db); | |||
void setGain(int gain); | void setGain(int gain); // 0 - 255 | |||
int getGain_db(float *gain_db); | int getGain_db(float *gain_db); | int getGain_db(float *gain_db); | ||
int getRGB_Gain_db(float *r_gain_db, float *g_gain_db, float *b_gain_db) ; | ||||
void autoExposure(int enable); | void autoExposure(int enable); | |||
int getExposure_us(int *exposure_us); | void setExposure(int exposure); // 0 - 65535 | int getExposure_us(int *exposure_us); | int getExposure_us(int *exposure_us); | |
void showRegisters(); | void showRegisters(); | void showRegisters(void); | void showRegisters(void); | void showRegisters(); |
void printRegisters(bool only_ones_set = true); | ||||
int sleep(int enable); | int setFramerate(int framerate); | |||
int setQuality(int qs); | int get_vt_pix_clk(uint32_t *vt_pix_clk); | int get_vt_pix_clk(uint32_t *vt_pix_clk); | ||
int getCameraClock(uint32_t *vt_pix_clk); | int getCameraClock(uint32_t *vt_pix_clk); | |||
uint8_t setMode(uint8_t Mode, uint8_t FrameCnt); | uint8_t setMode(uint8_t Mode, uint8_t FrameCnt); | |||
uint8_t cmdUpdate(); | uint8_t cmdUpdate(); | |||
uint8_t loadSettings(camera_reg_settings_t settings); | uint8_t loadSettings(camera_reg_settings_t settings); | |||
uint8_t getAE( ae_cfg_t *psAECfg); | uint8_t getAE(ae_cfg_t *psAECfg); | |||
uint8_t calAE( uint8_t CalFrames, uint8_t* Buffer, uint32_t ui32BufferLen, ae_cfg_t* pAECfg); |
Image capture is similar to what was done with the Teensy HM01B0 library:
1. GPIO
2. FLEXIO2 which supports DMA transfer
Double buffers have been tested for Framesizes up to VGA. If using the OV2640 JPEG images can be displayed up to SVGA and UXGA can be saved to SDCARD. Some modules support Windowing function which allows a smaller portion of the image to be displayed. See table above.
Currently the library has only been tested with the Teensy Micromod board but we will be testing with the Teensy 4.1 which supports PSRAM modules.
If anyone is interested they can check the library: https://github.com/mjs513/TeensyMM_Camera
This is still a work in progress so be warned. We have tried documenting as much as we could and a few extensive examples are available. The library is inspired from the Arduino GIGA Camera library, the ESP32 Camera library and the OpenMV project.
This is a quick overview and sure @KurtE will add more info and will be posting additional info in future threads