image — machine vision
The image module is used for machine vision.
Classes
- class Image – Image object
- class ImageIO – ImageIO object
- class HaarCascade – Feature Descriptor
- class Similarity – Similarity Object
- class Histogram – Histogram Object
- class Percentile – Percentile Object
- class Threshold – Threshold Object
- class Statistics – Statistics Object
- class Blob – Blob object
- class Line – Line object
- class Circle – Circle object
- class Rect – Rectangle Object
- class QRCode – QRCode object
- class AprilTag – AprilTag object
- class DataMatrix – DataMatrix object
- class BarCode – BarCode object
- class Displacement – Displacement object
- class kptmatch – Keypoint match object
Functions
- image.binary_to_grayscale(value: int) int
Convert a binary value (0-1) to a grayscale value (0-255).
- image.binary_to_rgb(value: int) Tuple[int, int, int]
Convert a binary value (0-1) to a 3-value RGB888 tuple.
- image.binary_to_lab(value: int) Tuple[int, int, int]
Convert a binary value (0-1) to a 3-value LAB tuple. L is 0-100; A/B are -128 to 127.
- image.binary_to_yuv(value: int) Tuple[int, int, int]
Convert a binary value (0-1) to a 3-value YUV tuple. Y is 0-255; U/V are -128 to 127.
- image.grayscale_to_binary(value: int) int
Convert a grayscale value (0-255) to a binary value (0-1).
- image.grayscale_to_rgb(value: int) Tuple[int, int, int]
Convert a grayscale value (0-255) to a 3-value RGB888 tuple.
- image.grayscale_to_lab(value: int) Tuple[int, int, int]
Convert a grayscale value (0-255) to a 3-value LAB tuple. L is 0-100; A/B are -128 to 127.
- image.grayscale_to_yuv(value: int) Tuple[int, int, int]
Convert a grayscale value (0-255) to a 3-value YUV tuple. Y is 0-255; U/V are -128 to 127.
- image.rgb_to_binary(value: Tuple[int, int, int]) int
Convert a 3-value RGB888 tuple to a binary value (0-1).
- image.rgb_to_grayscale(value: Tuple[int, int, int]) int
Convert a 3-value RGB888 tuple to a grayscale value (0-255).
- image.rgb_to_lab(value: Tuple[int, int, int]) Tuple[int, int, int]
Convert a 3-value RGB888 tuple to a 3-value LAB tuple. L is 0-100; A/B are -128 to 127.
- image.rgb_to_yuv(value: Tuple[int, int, int]) Tuple[int, int, int]
Convert a 3-value RGB888 tuple to a 3-value YUV tuple. Y is 0-255; U/V are -128 to 127.
- image.lab_to_binary(value: Tuple[int, int, int]) int
Convert a 3-value LAB tuple to a binary value (0-1).
- image.lab_to_grayscale(value: Tuple[int, int, int]) int
Convert a 3-value LAB tuple to a grayscale value (0-255).
- image.lab_to_rgb(value: Tuple[int, int, int]) Tuple[int, int, int]
Convert a 3-value LAB tuple to a 3-value RGB888 tuple.
- image.lab_to_yuv(value: Tuple[int, int, int]) Tuple[int, int, int]
Convert a 3-value LAB tuple to a 3-value YUV tuple. Y is 0-255; U/V are -128 to 127.
- image.yuv_to_binary(value: Tuple[int, int, int]) int
Convert a 3-value YUV tuple to a binary value (0-1).
- image.yuv_to_grayscale(value: Tuple[int, int, int]) int
Convert a 3-value YUV tuple to a grayscale value (0-255).
- image.yuv_to_rgb(value: Tuple[int, int, int]) Tuple[int, int, int]
Convert a 3-value YUV tuple to a 3-value RGB888 tuple.
- image.yuv_to_lab(value: Tuple[int, int, int]) Tuple[int, int, int]
Convert a 3-value YUV tuple to a 3-value LAB tuple. L is 0-100; A/B are -128 to 127.
- image.HaarCascade(path: str, stages: int = -1) Cascade
Load a Haar Cascade from a binary file at
pathand return a cascade object usable withImage.find_features(). Pass"frontalface"or"eye"to load a built-in cascade.stagesselects how many cascade stages to evaluate.-1uses all stages in the file. Lowering this value speeds up detection at the cost of more false positives.
- image.load_descriptor(path: str) Any
Load a descriptor object (
lbp_descorkp_desc) from the file atpathand return it.
- image.save_descriptor(descriptor: Any, path: str) None
Save the
descriptorobject (lbp_descorkp_desc) to the file atpath.
- image.match_descriptor(descriptor0: Any, descriptor1: Any, threshold: int = 85, filter_outliers: bool = False) int | kptmatch
Match two descriptors of the same type.
For LBP descriptors returns an integer distance between the two descriptors (lower is a closer match).
For ORB descriptors returns a
kptmatchobject.threshold(0-100) is used by ORB matching to filter ambiguous matches. Lower values tighten matching.filter_outliersenables outlier filtering for ORB matches.
- image.get_solidity(blob: blob) float
Return the solidity (blob area divided by convex-hull area) of
blob.
Constants
- image.RGB565: int
RGB565 pixel format. Each pixel is 16-bits, 2-bytes. 5-bits are used for red, 6-bits are used for green, and 5-bits are used for blue.
- image.BAYER: int
Raw Bayer pixel format. Most image processing methods are not available on Bayer images.
- image.YUV422: int
YUV422 pixel format. Each pixel pair is stored as
Y1, U, Y2, V(4 bytes for 2 pixels). Only some image processing methods work with YUV422.
- image.PALETTE_RAINBOW: int
Default OpenMV Cam color palette for thermal images using a smooth color wheel.
- image.PALETTE_IRONBOW: int
Makes images look like the FLIR Lepton thermal images using a very non-linear color palette.
- image.AREA: int
Use area scaling when downscaling an image (Nearest Neighbor is used for upscaling).
- image.BICUBIC: int
Use bicubic scaling. Higher quality than bilinear but slower. Subsamples when downscaling.
- image.CENTER: int
Center the drawn image on the destination. Any x/y offsets become offsets from center.
- image.EXTRACT_RGB_CHANNEL_FIRST: int
When extracting an RGB channel via
Image.draw_image(), extract the channel before scaling instead of after.
- image.APPLY_COLOR_PALETTE_FIRST: int
When applying a color palette via
Image.draw_image(), apply the palette before scaling instead of after.
- image.SCALE_ASPECT_KEEP: int
Scale the drawn image to fit inside the destination while maintaining aspect ratio.
- image.SCALE_ASPECT_EXPAND: int
Scale the drawn image to fill the destination while maintaining aspect ratio (may crop).
- image.SCALE_ASPECT_IGNORE: int
Scale the drawn image to fill the destination, ignoring aspect ratio.
- image.BLACK_BACKGROUND: int
Skip reading the destination pixel when drawing on a known-black destination. Speeds up alpha effects.
- image.JPEG_SUBSAMPLING_AUTO: int
Automatically select JPEG chroma subsampling based on image quality.
- image.JPEG_SUBSAMPLING_422: int
Force 4:2:2 JPEG chroma subsampling. Recommended when streaming MJPEG to third-party video players.
- image.EDGE_CANNY: int
Canny edge detection algorithm. See
Image.find_edges().
- image.EDGE_SIMPLE: int
Thresholded high-pass-filter edge detection. See
Image.find_edges().
- image.TAG16H5: int
AprilTag family. See
Image.find_apriltags().
- image.TAG25H9: int
AprilTag family. See
Image.find_apriltags().
- image.TAG36H10: int
AprilTag family. See
Image.find_apriltags().
- image.TAG36H11: int
AprilTag family. See
Image.find_apriltags().
- image.TAGCIRCLE21H7: int
AprilTag family. See
Image.find_apriltags().
- image.TAGCIRCLE49H12: int
AprilTag family. See
Image.find_apriltags().
- image.TAGCUSTOM48H12: int
AprilTag family. See
Image.find_apriltags().
- image.TAGSTANDARD41H12: int
AprilTag family. See
Image.find_apriltags().
- image.TAGSTANDARD52H13: int
AprilTag family. See
Image.find_apriltags().