Skip to content

Commit 3285909

Browse files
committed
Add header comments to examples
1 parent f37d860 commit 3285909

File tree

5 files changed

+81
-0
lines changed

5 files changed

+81
-0
lines changed

examples/ex01_hello_opencv.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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!
215
import cv2 as cv
316

examples/ex02_camera.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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
214
import cv2 as cv
315
from cv2_hardware_init import *

examples/ex03_touch_screen.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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
214
import cv2 as cv
315
from cv2_hardware_init import *

examples/ex04_imread_imwrite.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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
215
import cv2 as cv
316
from cv2_hardware_init import *

examples/ex05_detect_sfe_logo.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
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
233
import cv2 as cv
334
from cv2_hardware_init import *

0 commit comments

Comments
 (0)