Giter VIP home page Giter VIP logo

arduino_ov767x's Introduction

Arduino_OV767X Library for Arduino

Check Arduino status Compile Examples status Spell Check status

Capture images from your OmniVision OV7670 camera in your Arduino sketches.

This library is based on Linux Kernel’s V4L2 driver for OmniVision OV7670 cameras - which was created by Jonathan Corbet.

License

Copyright (c) 2021 Arduino SA. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

arduino_ov767x's People

Contributors

8bitkick avatar aentinger avatar arijitdas123student avatar bitbank2 avatar colbybanbury avatar dependabot[bot] avatar facchinm avatar per1234 avatar sandeepmistry avatar shawnhymel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino_ov767x's Issues

Feature Request: Crop

The camera is working very well using the Nano33BleSense, just wondering if the library already has the ability to crop images. My working output is 160 x 120 x 2(bytes), but for many machine learning applications the output needs to be square so 120 x 120 x 2(bytes). I am trying to write the cropping code directly but wondering if it is already buried within this library?

ov767x library works on ArduinoCore-nrf528x board but not the ArduinoCore-mbed

As far as I can tell this library compiles fine for both the Nano-33-Ble on the ArduinoCore-nrf528x board software and the ArduinoCore-mbed board software made for the new Portenta-H7 and Nano-33-Ble, but for the later the image does not show in the processing app. Also the board LED seems to be flashing as if it is trying to flash every time it sends a serial command (which would explain a massive slow down).

@mbanzi or @sbhklr or others, should this issue be in the https://github.com/arduino/ArduinoCore-mbed github, or should it stay here as an issue for the Arduino_ov767x library?

Feature Request. Any chance of QQQVGA Resolution?

Any chance of getting a few more resolutions out of the OV7670 Camera module. Here is a list of what OpenMV has going, For a bit of machine learning I would just like a few sizes smaller than what we already have, such as:

QQQVGA: 80x60
QQQQVGA: 40x30

Note: Smaller is faster and easier to process.

Data from OpenMV

sensor.QQCIF: 88x72
sensor.QCIF: 176x144
sensor.CIF: 352x288
sensor.QQSIF: 88x60
sensor.QSIF: 176x120
sensor.SIF: 352x240
sensor.QQQQVGA: 40x30
sensor.QQQVGA: 80x60
sensor.QQVGA: 160x120
sensor.QVGA: 320x240
sensor.VGA: 640x480
sensor.HQQQVGA: 80x40
sensor.HQQVGA: 160x80
sensor.HQVGA: 240x160
sensor.B64X32: 64x32 (for use with image.find_displacement())
sensor.B64X64: 64x64 (for use with image.find_displacement())
sensor.B128X64: 128x64 (for use with image.find_displacement())
sensor.B128X128: 128x128 (for use with image.find_displacement())
sensor.LCD: 128x160 (for use with the lcd shield)
sensor.QQVGA2: 128x160 (for use with the lcd shield)
sensor.WVGA: 720x480 (for the MT9V034)
sensor.WVGA2:752x480 (for the MT9V034)
sensor.SVGA: 800x600 (only for the OV2640/OV5640 sensor)
sensor.XGA: 1024x768 (only for the OV2640/OV5640 sensor)
sensor.SXGA: 1280x1024 (only for the OV2640/OV5640 sensor)
sensor.UXGA: 1600x1200 (only for the OV2640/OV5640 sensor)
sensor.HD: 1280x720 (only for the OV2640/OV5640 sensor)
sensor.FHD: 1920x1080 (only for the OV5640 sensor)
sensor.QHD: 2560x1440 (only for the OV5640 sensor)
sensor.QXGA: 2048x1536 (only for the OV5640 sensor)
sensor.WQXGA: 2560x1600 (only for the OV5640 sensor)
sensor.WQXGA2: 2592x1944 (only for the OV5640 sensor)

Camera OV7675 sleep_mode

I'm trying to reduce as low as possible my energy consumption, I'm working on an application involving the ov7675 camera (On the Tiny Ml Kit). I'll like to make an inference only once per hour, what I want to do is to put the camera into a deep sleep mode after each inference. the module is running with an edge impulse model for disease detection.

I've tried so far the function ei_camera_deinit() with the Cam.end() to stop the camera. what I notice is that at some intervals during power consumption measurement, the power reduces at the call of Cam.end(), but not at some other interval where the same Cam.end() is called.

image

Please add power consumption reduction to the library.

CC: @ShawnHymel

Why does this require mbed enabled boards?

Hello All,

Can the library be modified to work with non mbed enabled boards like the Nano 33 IoT?

I see the web-page talks about the 'processing' sketch - I haven't looked into that yet - it would imply the host is doing more image processing than the target board - correct? (Maybe that's incorrect...) - but if just raw RGB is streamed - then a Nano 33 IoT (or other board) should be fine.

I'll take a look at the lib when I have time - and I'll make a pull request if I get it to work.

Thanks,
John W.

Error compiling for board Arduino NANO 33 IoT

Hello,

Unable to compile Camera Test Pattern sketch. The error messages are:

Arduino: 1.8.12 (Linux), Board: "Arduino NANO 33 IoT"

WARNING: library Arduino_OV767X claims to run on mbed architecture(s) and may be incompatible with your current board which runs on samd architecture(s).
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp: In member function 'void OV767X::beginXClk()':
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:330:3: error: 'NRF_I2S' was not declared in this scope
   NRF_I2S->CONFIG.MCKEN = (I2S_CONFIG_MCKEN_MCKEN_ENABLE << I2S_CONFIG_MCKEN_MCKEN_Pos);
   ^~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:330:3: note: suggested alternative: 'ID_I2S'
   NRF_I2S->CONFIG.MCKEN = (I2S_CONFIG_MCKEN_MCKEN_ENABLE << I2S_CONFIG_MCKEN_MCKEN_Pos);
   ^~~~~~~
   ID_I2S
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:330:28: error: 'I2S_CONFIG_MCKEN_MCKEN_ENABLE' was not declared in this scope
   NRF_I2S->CONFIG.MCKEN = (I2S_CONFIG_MCKEN_MCKEN_ENABLE << I2S_CONFIG_MCKEN_MCKEN_Pos);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:330:61: error: 'I2S_CONFIG_MCKEN_MCKEN_Pos' was not declared in this scope
   NRF_I2S->CONFIG.MCKEN = (I2S_CONFIG_MCKEN_MCKEN_ENABLE << I2S_CONFIG_MCKEN_MCKEN_Pos);
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:330:61: note: suggested alternative: 'I2S_CLKCTRL_MCKEN_Pos'
   NRF_I2S->CONFIG.MCKEN = (I2S_CONFIG_MCKEN_MCKEN_ENABLE << I2S_CONFIG_MCKEN_MCKEN_Pos);
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                                             I2S_CLKCTRL_MCKEN_Pos
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:331:29: error: 'I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2' was not declared in this scope
   NRF_I2S->CONFIG.MCKFREQ = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2  << I2S_CONFIG_MCKFREQ_MCKFREQ_Pos;
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:331:68: error: 'I2S_CONFIG_MCKFREQ_MCKFREQ_Pos' was not declared in this scope
   NRF_I2S->CONFIG.MCKFREQ = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2  << I2S_CONFIG_MCKFREQ_MCKFREQ_Pos;
                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:331:68: note: suggested alternative: 'I2S_CLKCTRL_MCKEN_Pos'
   NRF_I2S->CONFIG.MCKFREQ = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2  << I2S_CONFIG_MCKFREQ_MCKFREQ_Pos;
                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                    I2S_CLKCTRL_MCKEN_Pos
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:332:26: error: 'I2S_CONFIG_MODE_MODE_MASTER' was not declared in this scope
   NRF_I2S->CONFIG.MODE = I2S_CONFIG_MODE_MODE_MASTER << I2S_CONFIG_MODE_MODE_Pos;
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:332:26: note: suggested alternative: 'USB_CONFIG_POWERED_MASK'
   NRF_I2S->CONFIG.MODE = I2S_CONFIG_MODE_MODE_MASTER << I2S_CONFIG_MODE_MODE_Pos;
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                          USB_CONFIG_POWERED_MASK
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:332:57: error: 'I2S_CONFIG_MODE_MODE_Pos' was not declared in this scope
   NRF_I2S->CONFIG.MODE = I2S_CONFIG_MODE_MODE_MASTER << I2S_CONFIG_MODE_MODE_Pos;
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:332:57: note: suggested alternative: 'SYSCTRL_BOD33_MODE_Pos'
   NRF_I2S->CONFIG.MODE = I2S_CONFIG_MODE_MODE_MASTER << I2S_CONFIG_MODE_MODE_Pos;
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~
                                                         SYSCTRL_BOD33_MODE_Pos
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:334:24: error: 'digitalPinToPinName' was not declared in this scope
   NRF_I2S->PSEL.MCK = (digitalPinToPinName(_xclkPin) << I2S_PSEL_MCK_PIN_Pos);
                        ^~~~~~~~~~~~~~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:334:24: note: suggested alternative: 'digitalPinToBitMask'
   NRF_I2S->PSEL.MCK = (digitalPinToPinName(_xclkPin) << I2S_PSEL_MCK_PIN_Pos);
                        ^~~~~~~~~~~~~~~~~~~
                        digitalPinToBitMask
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:334:57: error: 'I2S_PSEL_MCK_PIN_Pos' was not declared in this scope
   NRF_I2S->PSEL.MCK = (digitalPinToPinName(_xclkPin) << I2S_PSEL_MCK_PIN_Pos);
                                                         ^~~~~~~~~~~~~~~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:334:57: note: suggested alternative: 'I2S_CTRLA_CKEN_Pos'
   NRF_I2S->PSEL.MCK = (digitalPinToPinName(_xclkPin) << I2S_PSEL_MCK_PIN_Pos);
                                                         ^~~~~~~~~~~~~~~~~~~~
                                                         I2S_CTRLA_CKEN_Pos
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp: In member function 'void OV767X::endXClk()':
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:342:3: error: 'NRF_I2S' was not declared in this scope
   NRF_I2S->TASKS_STOP = 1;
   ^~~~~~~
/home/reza/Arduino/libraries/Arduino_OV767X/src/OV767X.cpp:342:3: note: suggested alternative: 'ID_I2S'
   NRF_I2S->TASKS_STOP = 1;
   ^~~~~~~
   ID_I2S
exit status 1
Error compiling for board Arduino NANO 33 IoT.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Board information:
BN: Arduino Nano 33 BLE
VID: 0x2341
PID: 0x805a
SN: 5BC0CE9072E5BEAF

Test Pattern zigzag

@facchinm @8bitkick

Can someone confirm that this version 0.0.2 of the arduino ov7670 library runs properly with the Nano 33 BLE and the Omnivision ov7670 camera.

For me it generates a zigzag pattern (using Processing version 3.5.4 https://processing.org/download/support.html ) with board manager mbed nrf5284 version 1.1.6 for the Nano 33 BLE. Note that loading older versions of this board does not seem to help.

testpattern

.

The ov7670 library does not generate any pattern with arduino_mbed_enabled boards version 1.2.2 for the Nano 33 BLE/PortentaH7.

This blog was probably made for version 0.0.1 ov7670 release (When I tried to install version 0.0.1 it did not install, when I downloaded it from this github it did not work). https://blog.arduino.cc/2020/06/24/machine-vision-with-low-cost-camera-modules/

It seems other people are having the same issue at this arduino forum https://forum.arduino.cc/index.php?topic=697294.0

I assume I have done something wrong but I am getting consistent bad results with multiple different wirings etc. Here is my camera view

camera-mess

Please reply. It would be interesting to know what is working for you.

ESP8266 compatibility?

Hi, thanks for the hard work guys.

I am kinda new to this kind of stuff and i was wondering if this library is compatible with esp8266 chip with arduino framework?

Can i make it work just by changing pins in header files?

Thanks a lot.

BLE and OV7670 don't work together

I designed a custom board with nRF 52840 microcontroller. And I use adafruit arduino core(Feather 52840 express) and bootloaders.
When I use 0V760 camera and BLE with together BLE crashed.Because 0V7670 library call noInterrupts() function and this function
cause BLE crashed. As a solution to this problem I use sd_nvic_critical_region_enter/exit functions but when ı
use these functions lines appear in the camera image. Is there any way to fix this problem?

COM5: Serial port naming on Windows

From blog comment:

The CameraVisualizerRawBytes for Processing didn’t work on Windows, until I changed the serial port from “COM5:” to “COM5”. I think the : symbol is a typo maybe?

A quick fix but I don't have a windows machine to test this on

Camera failing to initialize on nano 33 ble. Compiler warning suggests the Nano 33 ble has changed?

Hi I'm struggling to get the camera to initialize on the nano 33 ble. The same one mentioned in all of the examples.

Ive double checked all my wiring and also tried using both variations of the library. still no luck.

In both cases though the compiler throws this warning when I upload the script:

WARNING: library Arduino_OV767X claims to run on mbed architecture(s) and may be incompatible with your current board which runs on mbed_nano architecture(s).

But as far as I'm aware this is the same board? Was there a change in the definition for the chip on this board or has the chip itself changed for the 33 ble?? Googling has not been able to find me an answer but I might just be searching the wrong thing. Any help would be great.

Please let me know if I'm beening stupid and if this is an issue more appropriate for the arduino forums

Edit: Sorry I should probably add that it seems to be failing whenever the Camera.begin() function is called. Is there a version of the code that indicates exactly where it is failing? If not ill try my hand at modifying my local version to tell me.

Thanks again.

feature request: RGB565 convert to RGB888 function

Many machine learning programs expect RGB888 image format, wondering if a function that does that could be included in this library

I am loading my images to EdgeImpulse and using this conversion

void r565_to_rgb(uint16_t color, uint8_t *r, uint8_t *g, uint8_t *b) {

    *r = (color & 0xF800) >> 8;
    *g = (color & 0x07E0) >> 3;
    *b = (color & 0x1F) << 3;
}

I get an image like this. Note the image has already been cropped to 48x48 so the it will look grainy.

frame06

which becomes slightly better with this conversion

void r565_to_rgb(uint16_t color, uint8_t *r, uint8_t *g, uint8_t *b) {

      *r = ((((color >> 3) & 0x1F) * 527) + 23) >> 6;
      *g = ((((((color & 0xE0) >> 5) | ((color & 0x03) << 3)) & 0x3F) * 259) + 33) >> 6;
      *b = (((color & 0x1F) * 527) + 23) >> 6;
}

frame07-nano-fast06

Any suggestions on how to better convert the OV7670 RGB565 output?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.