back to home

petercorke / machinevision-toolbox-python

Machine vision toolbox for Python

View on GitHub
191 stars
29 forks
2 issues
Jupyter NotebookPythonMakefile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing petercorke/machinevision-toolbox-python in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/petercorke/machinevision-toolbox-python)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Machine Vision Toolbox for Python GitHub repository Documentation Wiki (examples and details) Installation Changelog A toolbox for machine vision that Pythonically wraps NumPy, SciPy, OpenCV, and Open3D. Synopsis The Machine Vision Toolbox for Python (MVTB-P) provides many functions that are useful in machine vision and vision-based control. The main components are: • An object with nearly 200 methods and properties that wrap functions from NumPy, OpenCV, SciPy, and Open3D. Methods support monadic, dyadic, filtering, edge detection, mathematical morphology and feature extraction (blobs, lines and point/corner features), as well as operator overloading. Images are stored as encapsulated NumPy arrays along with image metadata. • An object-oriented wrapper of Open3D functions that supports a subset of operations, but allows operator overloading and is compatible with the Spatial Math Toolbox. • A collection of camera projection classes for central (normal perspective), fisheye, catadioptric and spherical cameras. • Some advanced algorithms such as: • multiview geometry: camera calibration, stereo vision, bundle adjustment • bag of words Advantages of this Python Toolbox include: • it uses, as much as possible mature, efficient and portable functions which provide a comprehensive and mature collection of functions for image processing and feature extraction; • it wraps the OpenCV functions in a consistent way, hiding some of the gnarly details of OpenCV like conversion to/from float32 and the BGR color order. • it is has similarity to the Machine Vision Toolbox for MATLAB ® Getting going Using pip Install a snapshot from PyPI From GitHub Install the current code base from GitHub and pip install a link to that cloned copy Examples Reading and display an image Images can also be returned by iterators that operate over folders, zip files, local cameras, web cameras and video files. Simple image processing The toolbox supports many operations on images such as 2D filtering, edge detection, mathematical morphology, colorspace conversion, padding, cropping, resizing, rotation and warping. There are also many functions that operate on pairs of image. All the arithmetic operators are overloaded, and there are methods to combine images in more complex ways. Multiple images can be stacked horizontal, vertically or tiled in a 2D grid. For example, we could display the original and smoothed images side by side where is a class method that creates a new image by stacking the images from its argument, an image sequence, horizontally. Binary blobs A common problem in robotic vision is to extract features from the image, to describe the position, size, shape and orientation of objects in the scene. For simple binary scenes blob features are commonly used. where is a list-like object and each element describes a blob in the scene. The element's attributes describe various parameters of the object, and methods can be used to overlay graphics such as bounding boxes and centroids Binary blob hierarchy A more complex image is and we see that some blobs are contained within other blobs. The results in tabular form We can display a label image, where the value of each pixel is the label of the blob that the pixel belongs to, the attribute We can also think of the blobs forming a hiearchy and that relationship is reflected in the and attributes of the blobs. We can also express it as a directed graph Camera modelling and its intrinsic parameters are We can define an arbitrary point in the world and then project it into the camera which is the corresponding coordinate in pixels. If we shift the camera slightly the image plane coordinate will also change We can define an edge-based cube model and project it into the camera's image plane Color space Plot the CIE chromaticity space Load the spectrum of sunlight at the Earth's surface and compute the CIE xy chromaticity coordinates Hough transform SURF features We load two images and compute a set of SURF features for each We can match features between images based purely on the similarity of the features, and display the correspondences found where we have displayed the feature coordinates for four correspondences. We can also display the correspondences graphically in this case, a subset of 100/813 of the correspondences. Clearly there are some bad matches here, but we we can use RANSAC and the epipolar constraint implied by the fundamental matrix to estimate the fundamental matrix and classify correspondences as inliers or outliers where green lines show correct correspondences (inliers) and red lines show bad correspondences (outliers) History This package can be considered as a Python version of the [Machine Vision Toolbox for MATLAB](). That Toolbox, now quite old, is a collection of MATLAB functions and classes that supported the first two editions of the Robotics, Vision & Control book. It is a somewhat eclectic collection reflecting my personal interest in areas of photometry, photogrammetry, colorimetry. It includes over 100 functions spanning operations such as image file reading and writing, acquisition, display, filtering, blob, point and line feature extraction, mathematical morphology, homographies, visual Jacobians, camera calibration and color space conversion. This Python version differs in using an object to encapsulate the pixel data and image metadata, rather than just a native object holding pixel data. The many functions become methods of the image object which reduces namespace pollutions, and allows the easy expression of sequential operations using "dot chaining". The first version was created by Dorian Tsai during 2020, and based on the MATLAB version. That work was funded by an Australian University Teacher of the year award (2017) to Peter Corke.