File tree Expand file tree Collapse file tree 5 files changed +81
-0
lines changed Expand file tree Collapse file tree 5 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ #-------------------------------------------------------------------------------
2+ # SPDX-License-Identifier: MIT
3+ #
4+ # Copyright (c) 2025 SparkFun Electronics
5+ #-------------------------------------------------------------------------------
6+ # ex01_hello_opencv.py
7+ #
8+ # This example demonstrates near-minimal code to get started with OpenCV in
9+ # MicroPython. It can be used to verify that OpenCV is working correctly, and
10+ # that the display driver is functioning. It simpy imports the required modules,
11+ # creates a blank image, draws some things on it, and shows it on the display.
12+ #-------------------------------------------------------------------------------
13+
114# Import OpenCV, just as you would in any other Python environment!
215import cv2 as cv
316
Original file line number Diff line number Diff line change 1+ #-------------------------------------------------------------------------------
2+ # SPDX-License-Identifier: MIT
3+ #
4+ # Copyright (c) 2025 SparkFun Electronics
5+ #-------------------------------------------------------------------------------
6+ # ex02_camera.py
7+ #
8+ # This example demonstrates how to read frames from a camera and show them on a
9+ # display using OpenCV in MicroPython. It can be used to verify that the camera
10+ # driver is functioning.
11+ #-------------------------------------------------------------------------------
12+
113# Import OpenCV and hardware initialization module
214import cv2 as cv
315from cv2_hardware_init import *
Original file line number Diff line number Diff line change 1+ #-------------------------------------------------------------------------------
2+ # SPDX-License-Identifier: MIT
3+ #
4+ # Copyright (c) 2025 SparkFun Electronics
5+ #-------------------------------------------------------------------------------
6+ # ex03_touch_screen.py
7+ #
8+ # This example demonstrates how to read input from a touch screen, which can be
9+ # used to verify that the touch screen driver is functioning. It simply draws
10+ # lines on a blank image based on touch input, similar to a drawing application.
11+ #-------------------------------------------------------------------------------
12+
113# Import OpenCV and hardware initialization module
214import cv2 as cv
315from cv2_hardware_init import *
Original file line number Diff line number Diff line change 1+ #-------------------------------------------------------------------------------
2+ # SPDX-License-Identifier: MIT
3+ #
4+ # Copyright (c) 2025 SparkFun Electronics
5+ #-------------------------------------------------------------------------------
6+ # ex04_imread_imwrite.py
7+ #
8+ # This example demonstrates how to read and write images to and from the
9+ # MicroPython filesystem using `cv.imread()` and `cv.imwrite()`. Any paths
10+ # accessible to the MicroPython filesystem can be used, including an SD card if
11+ # your board has one connected.
12+ #-------------------------------------------------------------------------------
13+
114# Import OpenCV and hardware initialization module
215import cv2 as cv
316from cv2_hardware_init import *
Original file line number Diff line number Diff line change 1+ #-------------------------------------------------------------------------------
2+ # SPDX-License-Identifier: MIT
3+ #
4+ # Copyright (c) 2025 SparkFun Electronics
5+ #-------------------------------------------------------------------------------
6+ # ex05_detect_sfe_logo.py
7+ #
8+ # This example demonstrates a basic vision processing pipeline. It reads frames
9+ # from the camera, finds contours in the image, and compares them to a reference
10+ # contour to detect the SparkFun flame logo. Below is some (bad) ASCII art of
11+ # the logo for reference. The example draws the actual contour that it's looking
12+ # for in the top left corner of the display.
13+ #
14+ # ___
15+ # / _\
16+ # \ \
17+ # /|_| \/\
18+ # | |
19+ # | |
20+ # | /
21+ # | _____/
22+ # | /
23+ # |/
24+ #
25+ # If the logo is detected, it will be highlighted in red on the display. Note
26+ # that this vision pipeline is very simple and does not include many of the
27+ # steps that would typically be included in more robust pipelines for the sake
28+ # of simplicity and performance. So it may produce false positives or miss the
29+ # logo entirely in some cases.
30+ #-------------------------------------------------------------------------------
31+
132# Import OpenCV
233import cv2 as cv
334from cv2_hardware_init import *
You can’t perform that action at this time.
0 commit comments