adafruit / adafruit_circuitpython_pycamera Goto Github PK
View Code? Open in Web Editor NEWLibrary for the Adafruit PyCamera
Home Page: https://docs.circuitpython.org/projects/pycamera
License: MIT License
Library for the Adafruit PyCamera
Home Page: https://docs.circuitpython.org/projects/pycamera
License: MIT License
I suggest that we add a function to return the name of the last file written so we can do additional processing.
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
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')
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.
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.
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.
pycam.right.fell triggered by left button and pycam.left.fell triggered by right button on MEMENTO.
(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>
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
This is very minor issue, but in examples/filter/code.py there's
from font_free_mono_bold_24 import FONT
Where is this library?
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).
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
>>>
When taking pictures using the Fancy Camera code from this guide, all the pictures taken are timestamped 1999-12-31.
@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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.