Skip to content

Add imshow() #7

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

Merged
merged 10 commits into from
Jun 5, 2025
Merged

Add imshow() #7

merged 10 commits into from
Jun 5, 2025

Conversation

sfe-SparkFro
Copy link
Collaborator

Initial implementation of imshow().

This is a minor tweak to the standard imshow() API. Instead of passing a string for a window, the user passes an object that implements its own imshow() function that actually displays the image.

A sample display driver is included, plus an example showing fairly minimal code for a user to get started with MicroPython-OpenCV.

Copy link
Member

@gigapod gigapod left a comment

Choose a reason for hiding this comment

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

Overall it works ! (well, you said it does!).

All my comments are nits - better numpy usage (although I'm not sure if they work in upy) more needs before final production... etc.

Mostly just for compatibility with existing OpenCV code
Based on feedback in #7
Needed for new ST7789 implementation to convert other dtypes
Create helper functions for imshow() (could move these to a generic interface class for other display drivers to take advantage of)
Move machine dependency from example to display driver
Add extra checks for edge cases
Remove unused functions and arguments
Add clear() method
Fix imshow() with float images to clip instead of wrap the range 0-1
Other minor optimizations
@sfe-SparkFro
Copy link
Collaborator Author

waitKey() now actually behaves like OpenCV, getting the keypress from the REPL! Credit to this thread: https://github.com/orgs/micropython/discussions/11448

@sfe-SparkFro sfe-SparkFro merged commit 0830116 into features_for_launch Jun 5, 2025
@sfe-SparkFro sfe-SparkFro deleted the imshow branch June 5, 2025 20:30
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.

2 participants