Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image processing #16

Merged
merged 8 commits into from
Jan 26, 2024
Merged

Image processing #16

merged 8 commits into from
Jan 26, 2024

Conversation

jepler
Copy link
Member

@jepler jepler commented Jan 5, 2024

Now image wizards can do operations like sharpen & edge detect on image data in RAM. It only takes seconds and seconds.

This is memory efficient enough to operate on 240x208 pixel images.
(An earlier iteration which used float32s was not)

Typically an algorithm takes 1 to 4 seconds to run on an image. Channel
operations such as solarize are faster, while convolution operations like
sharpen are slower.

A range of algorithms are provided and there are building blocks to create
others.
@jepler
Copy link
Member Author

jepler commented Jan 5, 2024

Effects demo. The video is sped up.

PXL_20240105_012411687.2.mp4

@jepler
Copy link
Member Author

jepler commented Jan 5, 2024

an idea of the timings involved:

17ms to open
Full image size is 1920x1080
Bitmap is 240x208 pixels
will load at scale=3, giving 240x135 pixels
x=0 y=36 x1=0 y1=0
478ms to decode
applying effect=<function blue_cast at 0x0x3fcc0da0>
1174ms to apply effect
...
applying effect=<function blur at 0x0x3fcc0db0>
2839ms to apply effect
...
applying effect=<function edgedetect at 0x0x3fcc0de0>
3123ms to apply effect

np.minimum / maximum are surprisingly slow!
Copy link

github-actions bot commented Jan 5, 2024

👋 Thanks for this pull request! Unfortunately, it looks like the automated continuous integration (CI) test(s) failed. These can be tricky to fix so we've written a guide on how to fix them locally. It has pages about running pre-commit locally and another about building the docs locally with sphinx. Thanks for contributing to CircuitPython! If you have more questions, feel free to join the Adafruit Discord and post in #circuitpython-dev.

Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic! I'll release this as a minor up-rev unless you think it warrants a major up-rev due to either compatibility, memory, or other reason(s).

a non-default mock of displayio.Bitmap is provided for doc building
@jepler jepler merged commit 51309b9 into main Jan 26, 2024
2 checks passed
@jepler jepler deleted the image-processing branch January 26, 2024 17:15
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants