Coder Social home page Coder Social logo

adafruit / adafruit_circuitpython_pycamera Goto Github PK

View Code? Open in Web Editor NEW
14.0 12.0 8.0 272 KB

Library for the Adafruit PyCamera

Home Page: https://docs.circuitpython.org/projects/pycamera

License: MIT License

Python 100.00%
adafruit circuitpython esp32s3 ov5640 python

adafruit_circuitpython_pycamera's Introduction

Introduction

Documentation Status

Discord

Build Status

Code Style: Black

Library for the Adafruit PyCamera

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing from PyPI

This package is available on PyPI so that it can be installed by Thonny. It is not useful to install this package from PyPI on a Windows, Mac, or Linux computer.

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install adafruit_pycamera

Or the following command to update an existing version:

circup update

Usage Example

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

adafruit_circuitpython_pycamera's People

Contributors

brentru avatar caternuson avatar dhalbert avatar foamyguy avatar jepler avatar ladyada avatar tannewt avatar thekitty avatar vptechops avatar

Stargazers

 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

adafruit_circuitpython_pycamera's Issues

a way to clear out nvm text when running new code

I had run the main camera example and put it in STOP mode (which is great fun BTW!) and then started making a barebones camera example that only has JPEG mode. The text bars show the old "STOP" text and other things that may not be consistent with the new code.
Looking for a simple way to clear the NVM or set those text labels so they aren't misleading.

I'm using code like this to show how the settings work:

pycam.led_level = 1  # 0-4 preset brightnesses
pycam.led_color = 0  # 0 -
pycam.effect = 0  # 0-7
pycam.mode = 1 # 0-3 jpeg, gif, gboy, stopmotion

create /sd directory on CIRCUITPY drive

if /sd directory is missing from CIRUITPY drive we currently throw an error 'RuntimeError: Mount point directory missing'. This shows up when using the viewer example code.py
It would be great to make the directory for the user or add some instructions to the error on what to do to fix the problem.

Creating a PyCamera instance breaks WiFi

Adafruit CircuitPython 9.1.0-beta.1 on 2024-04-19; Adafruit Camera with ESP32S3

If the pycam = adafruilt_pycamera.PyCamera() line is commented out from the code.py file below the code runs fine, however when the line is included the io.get_feed("camera") statement fails with a "Name or service not known" error.

import os
import adafruit_pycamera
import wifi
import adafruit_requests
import adafruit_connection_manager
from adafruit_io.adafruit_io import IO_HTTP, AdafruitIO_RequestError

# Initialize memento camera
pycam = adafruit_pycamera.PyCamera()

print(f"Connecting to {os.getenv('CIRCUITPY_WIFI_SSID')}")
wifi.radio.connect(
    os.getenv("CIRCUITPY_WIFI_SSID"), os.getenv("CIRCUITPY_WIFI_PASSWORD")
)
print(f"Connected to {os.getenv('CIRCUITPY_WIFI_SSID')}!")

pool = adafruit_connection_manager.get_radio_socketpool(wifi.radio)
requests = adafruit_requests.Session(pool, adafruit_connection_manager.get_radio_ssl_context(wifi.radio))

# Initialize an Adafruit IO HTTP API object
aio_username = os.getenv("ADAFRUIT_AIO_USERNAME")
aio_key = os.getenv("ADAFRUIT_AIO_KEY")

io = IO_HTTP(os.getenv("ADAFRUIT_AIO_USERNAME"), os.getenv("ADAFRUIT_AIO_KEY"), requests)

# Adafruit IO feed configuration
# Get the 'camera' feed from Adafruit IO
feed_camera = io.get_feed("camera")

Error Output:

code.py output:
Found AW9523
reset camera
Initializing camera
Found camera OV5640 (240 x 176) at I2C address 3c
colors 16777215
colors 16777215
/lib/adafruit_pycamera/ov5640_autofocus.bin
init done @ 2.86206
sdcard init @ 2.9209
mount vfs @ 3.03101
Connecting to twilightzone
Connected to twilightzone!
Traceback (most recent call last):
  File "code.py", line 28, in <module>
  File "adafruit_io/adafruit_io.py", line 748, in get_feed
  File "adafruit_io/adafruit_io.py", line 578, in _get
  File "adafruit_requests.py", line 591, in get
  File "adafruit_requests.py", line 525, in request
  File "adafruit_connection_manager.py", line 321, in get_socket
gaierror: (-2, 'Name or service not known')

framing masks

it would be great to add optional framing masks to match the different resolutions/aspect ratios. Either viewfinder-style outline or full black blocking mask so you can properly frame in the viewfinder.

Turn off debug output

At some point would be nice to turn off the debug output - or make optional. It's useful stuff, so not suggesting just deleting.

>>> pycam = adafruit_pycamera.PyCamera()
FutureWarning: FourWire moved from displayio to fourwire
FutureWarning: Display moved from displayio to busdisplay
FutureWarning: Display renamed BusDisplay
reset camera
pre cam @ 0.333008
I2C addresses found: ['0x19', '0x58']
Found AW9523
sdcard done @ 0.399414
Initializing camera
Found camera OV5640 (240 x 176) at I2C address 3c
camera done @ 1.19922
['__class__', '__enter__', '__exit__', 'address', 'ae_level', 'aec2', 'aec_value', 'agc_gain', 'awb_gain', 'bpc', 'brightness', 'colorbar', 'contrast', 'dcw', 'deinit', 'denoise', 'exposure_ctrl', 'frame_available', 'frame_size', 'framebuffer_count', 'gain_ceiling', 'gain_ctrl', 'grab_mode', 'height', 'hmirror', 'lenc', 'max_frame_size', 'pixel_format', 'quality', 'raw_gma', 'reconfigure', 'saturation', 'sensor_name', 'sharpness', 'special_effect', 'supports_jpeg', 'take', 'vflip', 'wb_mode', 'whitebal', 'width', 'wpc']
colors 16777215
colors 16777215
init done @ 2.13428
>>>

horizontally flipped preview/image

I'm seeing horizontally flipped/mirrored images in live preview and in saved images when using the examples/camera/code.py
I tried setting pycam.hmirror = False but this didn't seem to make a difference.

Fun overlay demos

@FoamyGuy
idea is to have a 'transparent background' frame file on the SD card or internal memeory that will be OR'd onto the image to give it a custom border! ideally the frame would also be visible in the preview

basically, simulate this:
image

Add custom file name to capture_jpeg()

Thank you for developing the great library as always. This is an improvement request.
It would be better to let user assign the 'stem file name' for capture_jpeg() instead of fixed 'img0001.jpeg' file name. If we connect RTC to MEMENTO, I can add the datetime to the file name (e.g. img-YYYYMMDD-hhmmss-0001.jpeg).

Dependency Issue for adafruit_pycamera? Missing 'adafruit_lis3dh'

I ran a circup install with the following screen output

(base) PS C:\Users\debl2> circup install adafruit_pycamera
Found device at H:\, running CircuitPython 9.0.0-alpha.6.
Searching for dependencies for: ['adafruit_pycamera']
WARNING:
        typing-extensions is not a known CircuitPython library.
Ready to install: ['adafruit_aw9523', 'adafruit_bus_device', 'adafruit_pycamera', 'adafruit_register']

Installed 'adafruit_aw9523'.
Installed 'adafruit_bus_device'.
Installed 'adafruit_pycamera'.
Installed 'adafruit_register'.
(base) PS C:\Users\debl2>

When I do an 'import adafruit_pycamera' from either the command line in mu Editor or from code containing the import I get the error output below:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "camTest.py", line 12, in <module>
  File "adafruit_pycamera/__init__.py", line 16, in <module>
ImportError: no module named 'adafruit_lis3dh

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.