examples: Fix imports.

This commit is contained in:
iabdalkader 2023-07-05 16:27:06 +02:00
parent 3d1f5ace5f
commit 53fa4430be
259 changed files with 751 additions and 259 deletions

View File

@ -2,7 +2,8 @@
#
# Welcome to the OpenMV IDE! Click on the green run arrow button below to run the script!
import sensor, image, time
import sensor
import time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)

View File

@ -4,7 +4,8 @@
#
# You can use your OpenMV Cam to save modified image files.
import sensor, image, pyb
import sensor
import pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -4,7 +4,8 @@
#
# You can use your OpenMV Cam to save image files.
import sensor, image, pyb
import sensor
import pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -5,7 +5,9 @@
# This example demonstrates using face tracking on your OpenMV Cam to take a
# picture.
import sensor, image, pyb
import sensor
import image
import pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -5,7 +5,9 @@
# This example demonstrates using frame differencing with your OpenMV Cam to do
# motion detection. After motion is detected your OpenMV Cam will take picture.
import sensor, image, pyb, os
import sensor
import pyb
import os
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -8,7 +8,10 @@
# pictures it will run the bootloader each time. Please power the camera
# from something other than USB to not have the bootloader run.
import pyb, machine, sensor, image, pyb, os
import pyb
import machine
import sensor
import os
# Create and init RTC object. This will allow us to set the current time for
# the RTC and let us set an interrupt to wake up later on.

View File

@ -6,7 +6,10 @@
# recorder object RGB565 frames or Grayscale frames. Use photo editing software
# like GIMP to compress and optimize the Gif before uploading it to the web.
import sensor, image, time, gif, pyb
import sensor
import time
import gif
import pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -9,7 +9,11 @@
# This example demonstrates using face tracking on your OpenMV Cam to take a
# gif.
import sensor, image, time, gif, pyb
import sensor
import image
import time
import gif
import pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -9,7 +9,11 @@
# This example demonstrates using frame differencing with your OpenMV Cam to do
# motion detection. After motion is detected your OpenMV Cam will take video.
import sensor, image, time, gif, pyb, os
import sensor
import time
import gif
import pyb
import os
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -2,7 +2,9 @@
#
# This example shows how to use the ImageIO stream to record frames in memory and play them back.
# Note: While this should work on any board, the board should have an SDRAM to be of any use.
import sensor, image, time
import sensor
import image
import time
# Number of frames to pre-allocate and record
N_FRAMES = 500

View File

@ -8,7 +8,9 @@
# Altered to allow full speed reading from SD card for extraction of sequences to the network etc.
# Set the new pause parameter to false
import sensor, image, time
import sensor
import image
import time
snapshot_source = False # Set to true once finished to pull data from sensor.

View File

@ -6,7 +6,10 @@
# OpenMV Cam sees for later analysis using the Image Reader object. Images written to disk
# by the Image Writer object are stored in a simple file format readable by your OpenMV Cam.
import sensor, image, pyb, time
import sensor
import image
import pyb
import time
record_time = 10000 # 10 seconds in milliseconds

View File

@ -7,7 +7,10 @@
# recording a Mjpeg file you can use VLC to play it. If you are on Ubuntu then
# the built-in video player will work too.
import sensor, image, time, mjpeg, pyb
import sensor
import time
import mjpeg
import pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -10,7 +10,11 @@
# This example demonstrates using face tracking on your OpenMV Cam to take a
# mjpeg.
import sensor, image, time, mjpeg, pyb
import sensor
import image
import time
import mjpeg
import pyb
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -10,7 +10,11 @@
# This example demonstrates using frame differencing with your OpenMV Cam to do
# motion detection. After motion is detected your OpenMV Cam will take video.
import sensor, image, time, mjpeg, pyb, os
import sensor
import time
import mjpeg
import pyb
import os
RED_LED_PIN = 1
BLUE_LED_PIN = 3

View File

@ -10,7 +10,9 @@
# forward/backwards to see the numbers change.
# I.e. Z direction changes only.
import sensor, image, time, math
import sensor
import time
import math
# NOTE!!! You have to use a small power of 2 resolution when using
# find_displacement(). This is because the algorithm is powered by

View File

@ -10,7 +10,8 @@
# watch the numbers change. Note that you can see displacement numbers
# up +- half of the hoizontal and vertical resolution.
import sensor, image, time
import sensor
import time
# NOTE!!! You have to use a small power of 2 resolution when using
# find_displacement(). This is because the algorithm is powered by

View File

@ -10,7 +10,9 @@
# forward/backwards to see the numbers change.
# I.e. Z direction changes only.
import sensor, image, time, math
import sensor
import time
import math
# NOTE!!! You have to use a small power of 2 resolution when using
# find_displacement(). This is because the algorithm is powered by

View File

@ -10,7 +10,8 @@
# watch the numbers change. Note that you can see displacement numbers
# up +- half of the hoizontal and vertical resolution.
import sensor, image, time
import sensor
import time
# NOTE!!! You have to use a small power of 2 resolution when using
# find_displacement(). This is because the algorithm is powered by

View File

@ -22,7 +22,9 @@ BLOCK_H = 16 # pow2
# forward/backwards to see the numbers change.
# I.e. Z direction changes only.
import sensor, image, time, math
import sensor
import time
import math
# NOTE!!! You have to use a small power of 2 resolution when using
# find_displacement(). This is because the algorithm is powered by

View File

@ -20,7 +20,8 @@ BLOCK_H = 16 # pow2
# watch the numbers change. Note that you can see displacement numbers
# up +- half of the hoizontal and vertical resolution.
import sensor, image, time
import sensor
import time
# NOTE!!! You have to use a small power of 2 resolution when using
# find_displacement(). This is because the algorithm is powered by

View File

@ -22,7 +22,9 @@ BLOCK_H = 16 # pow2
# forward/backwards to see the numbers change.
# I.e. Z direction changes only.
import sensor, image, time, math
import sensor
import time
import math
# NOTE!!! You have to use a small power of 2 resolution when using
# find_displacement(). This is because the algorithm is powered by

View File

@ -20,7 +20,8 @@ BLOCK_H = 16 # pow2
# watch the numbers change. Note that you can see displacement numbers
# up +- half of the hoizontal and vertical resolution.
import sensor, image, time
import sensor
import time
# NOTE!!! You have to use a small power of 2 resolution when using
# find_displacement(). This is because the algorithm is powered by

View File

@ -3,7 +3,9 @@
# The frogeye2020 is a 320x240 event camera. There are two bits per pixel which show no motion,
# motion in one direction, or motion in another direction. The sensor runs at 50 FPS.
import sensor, image, time
import sensor
import image
import time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)

View File

@ -3,7 +3,9 @@
# The frogeye2020 is a 320x240 event camera. There are two bits per pixel which show no motion,
# motion in one direction, or motion in another direction. The sensor runs at 50 FPS.
import sensor, image, time
import sensor
import image
import time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)

View File

@ -12,7 +12,8 @@
# time so you will not get the maximum readout speed unless you reduce the exposure time too.
# This results in a dark image however so YOU NEED A LOT of lighting for high FPS.
import sensor, image, time
import sensor
import time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to GRAYSCALE

View File

@ -12,7 +12,8 @@
# continously by the camera and because you have to wait for the integration to finish before
# readout of the frame.
import sensor, image, time
import sensor
import time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to GRAYSCALE

View File

@ -17,7 +17,8 @@
# leptons don't have radiometry support or they don't activate their calibration process often
# enough to deal with temperature changes (FLIR 2.5).
import sensor, image, time, math
import sensor
import time
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(100, 255)] # track very hot objects

View File

@ -17,7 +17,8 @@
# leptons don't have radiometry support or they don't activate their calibration process often
# enough to deal with temperature changes (FLIR 2.5).
import sensor, image, time, math
import sensor
import time
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(200, 255)]

View File

@ -17,7 +17,8 @@
# leptons don't have radiometry support or they don't activate their calibration process often
# enough to deal with temperature changes (FLIR 2.5).
import sensor, image, time, math
import sensor
import time
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(200, 255)]

View File

@ -17,7 +17,9 @@
# leptons don't have radiometry support or they don't activate their calibration process often
# enough to deal with temperature changes (FLIR 2.5).
import sensor, image, time, math, lcd
import sensor
import time
import lcd
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(200, 255)]

View File

@ -17,7 +17,9 @@
# leptons don't have radiometry support or they don't activate their calibration process often
# enough to deal with temperature changes (FLIR 2.5).
import sensor, image, time, math, lcd
import sensor
import time
import lcd
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(200, 255)]

View File

@ -7,7 +7,8 @@
# stablizes. You can force the re-calibration to not happen if you need to via the lepton API.
# However, it is not recommended because the image will degrade overtime.
import sensor, image, time, math
import sensor
import time
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(220, 255)]

View File

@ -7,7 +7,9 @@
# stablizes. You can force the re-calibration to not happen if you need to via the lepton API.
# However, it is not recommended because the image will degrade overtime.
import sensor, image, time, math, lcd
import sensor
import time
import lcd
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(220, 255)]

View File

@ -7,7 +7,8 @@
# stablizes. You can force the re-calibration to not happen if you need to via the lepton API.
# However, it is not recommended because the image will degrade overtime.
import sensor, image, time, math
import sensor
import time
# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
threshold_list = [( 70, 100, -30, 40, 20, 100)]

View File

@ -7,7 +7,9 @@
# stablizes. You can force the re-calibration to not happen if you need to via the lepton API.
# However, it is not recommended because the image will degrade overtime.
import sensor, image, time, math, lcd
import sensor
import time
import lcd
# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
threshold_list = [( 70, 100, -30, 40, 20, 100)]

View File

@ -17,7 +17,8 @@
# leptons don't have radiometry support or they don't activate their calibration process often
# enough to deal with temperature changes (FLIR 2.5).
import sensor, image, time, math
import sensor
import time
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(220, 255)]

View File

@ -17,7 +17,8 @@
# leptons don't have radiometry support or they don't activate their calibration process often
# enough to deal with temperature changes (FLIR 2.5).
import sensor, image, time, math
import sensor
import time
# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
threshold_list = [( 70, 100, -30, 40, 20, 100)]

View File

@ -3,7 +3,9 @@
# This example shows off how to overlay a depth map onto
# OpenMV Cam's live video output from the main camera.
import image, time, tof
import image
import time
import tof
IMAGE_SCALE = 10 # Higher scaling uses more memory.
drawing_hint = image.BILINEAR # or image.BILINEAR or 0 (nearest neighbor)

View File

@ -2,7 +2,10 @@
#
# This example shows off how to overlay a depth map onto
# OpenMV Cam's live video output from the main camera.
import sensor, image, time, tof
import sensor
import image
import time
import tof
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -22,7 +22,8 @@
# more when the lighting changes versus the exposure being constant and
# the gain changing.
import sensor, image, time
import sensor
import time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)

View File

@ -15,7 +15,8 @@
# noise. So, it's best to let the exposure increase as much as possible
# and then use gain control to make up any remaining ground.
import sensor, image, time
import sensor
import time
# Change this value to adjust the exposure. Try 10.0/0.1/etc.
EXPOSURE_TIME_SCALE = 1.0

View File

@ -3,7 +3,8 @@
# This example shows off horizontally mirroring the image in hardware
# from the camera sensor.
import sensor, image, time
import sensor
import time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)

View File

@ -13,7 +13,8 @@
# the sensor on startup you can control the colors
# the camera sees.
import sensor, image, time
import sensor
import time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)

View File

@ -3,7 +3,8 @@
# This example shows off vertically flipping the image in hardware
# from the camera sensor.
import sensor, image, time
import sensor
import time
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)

View File

@ -15,7 +15,8 @@
# noise. So, it's best to let the exposure increase as much as possible
# and then use gain control to make up any remaining ground.
import sensor, image, time
import sensor
import time
# Change this value to adjust the gain. Try 10.0/0/0.1/etc.
GAIN_SCALE = 1.0

View File

@ -3,7 +3,8 @@
# This example is was designed and tested on the OpenMV Cam H7 Plus using the OV5640 sensor.
import sensor, image, time
import sensor
import time
EXPOSURE_MICROSECONDS = 1000
TRACKING_THRESHOLDS = [(128, 255)] # When you lower the exposure you darken everything.

View File

@ -3,7 +3,8 @@
# This example is was designed and tested on the OpenMV Cam H7 Plus using the OV5640 sensor.
import sensor, image, time
import sensor
import time
# This example script forces the exposure to a constant value for the whole time. However, you may
# wish to dynamically adjust the exposure when the readout window shrinks to a small size.

View File

@ -2,7 +2,9 @@
#
# This example shows off drawing arrows on the OpenMV Cam.
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,9 @@
#
# This example shows off drawing circles on the OpenMV Cam.
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,9 @@
#
# This example shows how to load and copy an image to framebuffer for testing.
import sensor, image, time
import sensor
import image
import time
# Still need to init sensor
sensor.reset()

View File

@ -2,7 +2,9 @@
#
# This example shows off drawing crosses on the OpenMV Cam.
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,9 @@
#
# This example shows off drawing ellipses on the OpenMV Cam.
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,8 @@
#
# This example shows off flood filling areas in the image.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,9 @@
#
# This example shows off how to draw images in the frame buffer.
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,10 @@
#
# Exercise draw image with many different values for testing
import sensor, image, time, pyb
import sensor
import image
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -5,7 +5,9 @@
# area scaling along with color channel extraction, alpha blending,
# color palette application, and alpha palette application.
import sensor, image, time
import sensor
import image
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -5,7 +5,9 @@
# area scaling along with color channel extraction, alpha blending,
# color palette application, and alpha palette application.
import sensor, image, time
import sensor
import image
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -5,7 +5,9 @@
# area scaling along with color channel extraction, alpha blending,
# color palette application, and alpha palette application.
import sensor, image, time
import sensor
import image
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -5,7 +5,9 @@
# area scaling along with color channel extraction, alpha blending,
# color palette application, and alpha palette application.
import sensor, image, time
import sensor
import image
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -7,7 +7,9 @@
# DISABLE THE FRAME BUFFER TO SEE THE REAL FPS
import sensor, image, time
import sensor
import image
import time
up_hint = 0 # image.BILINEAR image.BICUBIC
down_hint = image.AREA # image.BILINEAR image.BICUBIC image.AREA

View File

@ -7,7 +7,9 @@
# DISABLE THE FRAME BUFFER TO SEE THE REAL FPS
import sensor, image, time
import sensor
import image
import time
hint = 0 # image.BILINEAR image.BICUBIC

View File

@ -2,7 +2,10 @@
#
# This example shows off how to draw images in the frame buffer with a custom generated color palette.
import sensor, image, time, pyb
import sensor
import image
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...

View File

@ -3,7 +3,9 @@
# This example shows off drawing keypoints on the OpenMV Cam. Usually you call draw_keypoints()
# on a keypoints object but you can also call it on a list of 3-value tuples...
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,9 @@
#
# This example shows off drawing lines on the OpenMV Cam.
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,9 @@
#
# This example shows off drawing rectangles on the OpenMV Cam.
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,9 @@
#
# This example shows off drawing text on the OpenMV Cam.
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -6,7 +6,8 @@
# the image contrast versus a global histogram equalization. Additionally,
# you may specify a clip limit to prevent the contrast from going wild.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -2,7 +2,8 @@
#
# This example shows off using the guassian filter to blur images.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565

View File

@ -4,7 +4,8 @@
# filter works by joining similar pixel areas of an image and replacing
# the pixels in those areas with the area mean.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565) # or GRAYSCALE...

View File

@ -2,7 +2,8 @@
#
# This example shows off using the bilateral filter on color images.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.RGB565

View File

@ -3,7 +3,8 @@
# This script shows off the binary image filter. You may pass binary any
# number of thresholds to segment the image by.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_framesize(sensor.QVGA)

View File

@ -7,7 +7,8 @@
# histeq() on the image without outliers from oversaturated
# parts of the image breaking the algorithm...
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -2,7 +2,8 @@
#
# This example shows off using the laplacian filter to detect edges.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565

View File

@ -4,7 +4,8 @@
# a binary image to remove noise. This example was originally a test but its
# useful for showing off how these functions work.
import pyb, sensor, image
import pyb
import sensor
sensor.reset()
sensor.set_framesize(sensor.QVGA)

View File

@ -3,7 +3,8 @@
# This example shows off gamma correction to make the image brighter. The gamma
# correction method can also fix contrast and brightness too.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -2,7 +2,8 @@
#
# This example shows off using the bilateral filter on grayscale images.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565

View File

@ -3,7 +3,8 @@
# This script shows off the binary image filter. You may pass binary any
# number of thresholds to segment the image by.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_framesize(sensor.QVGA)

View File

@ -7,7 +7,8 @@
# histeq() on the image without outliers from oversaturated
# parts of the image breaking the algorithm...
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565

View File

@ -3,7 +3,8 @@
# This example shows off how to use histogram equalization to improve
# the contrast in the image.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -2,7 +2,8 @@
#
# This example shows off how to use a generic kernel filter.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565

View File

@ -5,7 +5,8 @@
# detection. Increase the strength below until lines are straight in the view.
# Zoom in (higher) or out (lower) until you see enough of the image.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -5,7 +5,8 @@
# become translations in the X direction and linear changes
# in scale become linear translations in the Y direction.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -5,7 +5,8 @@
# become translations in the X direction and exponential changes
# in scale (x2, x4, etc.) become linear translations in the Y direction.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -4,7 +4,8 @@
# When mean(threshold=True) the mean() method adaptive thresholds the image
# by comparing the mean of the pixels around a pixel, minus an offset, with that pixel.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -4,7 +4,8 @@
# filter in a NxN neighborhood. Mean filtering removes noise in the image by
# bluring everything. But, it's the fastest kernel filter operation.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -4,7 +4,8 @@
# When median(threshold=True) the median() method adaptive thresholds the image
# by comparing the median of the pixels around a pixel, minus an offset, with that pixel.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -4,7 +4,8 @@
# with the median value of it's NxN neighborhood. Median filtering is good for
# removing noise in the image while preserving edges.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -4,7 +4,8 @@
# When midpoint(threshold=True) the midpoint() method adaptive thresholds the image
# by comparing the midpoint of the pixels around a pixel, minus an offset, with that pixel.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -3,7 +3,8 @@
# This example shows off midpoint filtering. Midpoint filtering replaces each
# pixel by the average of the min and max pixel values for a NxN neighborhood.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -5,7 +5,8 @@
# by comparing the mode of the pixels around a pixel, minus an offset, with that pixel.
# Avoid using the mode filter on RGB565 images. It will cause artifacts on image edges...
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565

View File

@ -5,7 +5,8 @@
# of pixels around it. Avoid using the mode filter on RGB565 images. It will
# cause artifacts on image edges...
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565

View File

@ -3,7 +3,8 @@
# This example shows off negating the image. This is not a particularly
# useful method but it can come in handy once in a while.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

View File

@ -4,7 +4,8 @@
# perspective distortion and then to rotate the new corrected image in 3D
# space aftwards to handle movement.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -3,7 +3,8 @@
# This example shows off how to use the rotation_corr() to fix perspective
# issues related to how your OpenMV Cam is mounted.
import sensor, image, time
import sensor
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

View File

@ -3,7 +3,8 @@
# This example shows off how to use the rotation_corr() to play with the scene
# window your OpenMV Cam sees.
import sensor, image, time
import sensor
import time
# Degrees per frame to rotation by...
X_ROTATION_DEGREE_RATE = 5

View File

@ -2,7 +2,8 @@
#
# This example shows off using the laplacian filter to sharpen images.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565

View File

@ -4,7 +4,8 @@
# NOTE: ndarrays cause the heap to be fragmented easily. If you run out of memory,
# there's not much that can be done about it, lowering the resolution might help.
import sensor, image, time
import sensor
import time
from ulab import numpy as np
sensor.reset() # Reset and initialize the sensor.

View File

@ -2,7 +2,8 @@
#
# This example shows off using the guassian filter to unsharp mask filter images.
import sensor, image, time
import sensor
import time
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565

View File

@ -8,7 +8,9 @@
# vflip=True, hmirror=True, transpose=False -> 180 degree rotation
# vflip=False, hmirror=True, transpose=True -> 270 degree rotation
import sensor, image, time, pyb
import sensor
import time
import pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565)

Some files were not shown because too many files have changed in this diff Show More