Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

A library for functions related to multiple view geometry in Mathematica.

Notifications You must be signed in to change notification settings

tvogels/MathematicaComputerVision

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MathematicaComputerVision

A library for functions related to multiple view geometry in Mathematica.

  • Author: Thijs Vogels
  • Supervisor: Dr. Richard van den Doel
  • Roosevelt University College, Middelburg, Netherlands

Installation

  1. Download the application zip-file
  2. Go to File>Install in Mathematica and select the zip.

Documentation

The application documentation will be integrated in the native Mathematica docs.

Available functions

Utilities

Hgc[x] converts a list x representing a point in n-dimensional space to homogeneous coordinates by appending a 1.
Nc[x] converts a list x representing a point in homogeneous coordinates to non-homogeneous coordinates by stripping the last element and dividing by it. If the point lies on infintiy, a warning is thrown.
Intersect[l,m] returns the intersection the homogeneous 2d lines l and m.
LineThrough[p,q] returns the line joining the homogeneous 2d points p and q.
LineDirection[l] returns the direction of the line l.
RQ[M] is a variant of the QR Decomposition such that A=R.Q, and R is upper triangular and Q orthogonal.
Rxyz[α,β,γ] gives a 3x3 rotation matrix that first translates a in the x-direction, then b in the y direction and c in the z-direction.

Homographies

NormalizePoints[pts] normalizes a set of non-homogeneous or non-infinite homogeneous 2d points such that: * their centroid is in the origin * their mean distance from the origin is sqrt(2) Returns the normalized set of points and the transformation that transforms a set of homogeneous points to the normalized ones (for denormalization purposes)
NormalizePoints3D[pts] normalizes a set of non-homogeneous or non-infinite homogeneous 3d points such that: * their centroid is in the origin * their mean distance from the origin is sqrt(3) Returns the normalized set of points and the transformation that transforms a set of homogeneous points to the normalized ones (for denormalization purposes)
Homography2D[x,y] calculates a homography between two sets of homogeneous 2D points x and y using the Direct Linear Transformation algorithm (Hartley&Zisserman, p.89). For optimal results the Gold Standard algorithm should be used.

Camera Matrix

CameraMatrixFromCorrespondences[corr] gives the camera matrix for >=6 {world,pixel} correspondences (homogeneous coordinates) using a DLT method.
DecomposeCamera[P] decomposes the camera into {K,R,t} such that P = K.R.[I | -t].
DrawCamera[P] gives a 3D object showing the camera orientation. To be used inside a Graphics3D environment. It uses the img for its dimensions. DrawCamera[P,size] does the same with a given size. DrawCamera[P,size,img] let's you specify an image used to find correct the width and height of the screen.

Camera Calibration

Based on images of three black squares on a contrasting background.

SeparateSquares[img,nsquares] takes an image of n black squares (on a constrasting background) and returns n white images of those squares on a black background. It defaults to 3 squares.
CornerInQuadrangleImage[square] calculates the four corner points in an image of a quadrangle by first finding the edges and intersecting those. Returns the points in non-homogeneous coordinates.
CameraCalibrationFromImagedSquares[squares] returns the internal camera parameters K from the (non-homogeneous) corner points of (at least) three imaged squares. It identifies the image of the absolute conic, and uses a Cholesky decomposition to derive K from omega.
CameraCalibrationFromImagedSquaresAssertingZeroSkew[squares] returns the internal camera parameters K from the (non-homogeneous) corner points of (at least) three imaged squares. It identifies the image of the absolute conic, and uses a Cholesky decomposition to derive K from omega. It asserts zero skew.

Fundamental Matrix

FFromCorrespondences[corr] gives a fundamental from a list of point correspondences using a DLT algorithm.
EFromFK[F,K] gives the essential matrix corresponding to a fundamental matrix F and a calibration matrix K.
DecomposeE[E] returns four possible second camera matrices that form a couple with [I|0] based on an essential matrix E.

Scene Reconstruction

Triangulate[corr,P1,P2] gives a DLT-estimate of the 3D-location of corresponding image point correlations in two images and the two camera matrices.

Image Manipulation

ImageCoordinateToDataPoint[p,img] converts image coordinates (origin left-bottom) to a corresponding data point (origin left-top)
ImageColorAtCoordinate[p,img] returns the color at coordinate p (origin left-bottom)
LinePointsInImage[l,img] gives the two extreme points on an image of a homogeneous line (snapped to pixel-positions)
NOT TESTED for lines that lie completely outside the image
LineInImage[l,img] takes the points from LinePointsInImage and makes it a Graphics primitive.

Least squares fitting

FitConic[points] fits a conic through at least 5 homogeneous points using linear minimization.
FitLine[points] gives a least squares fit of a line to a set of points.

RANSAC

RANSAC[x, fittingfn, distfn, degenfn, s, t, feedback, maxDataTrials, maxTrials] is a general RANSAC implementation. The last three arguments are optional.

File System

LoadImagesInDirectory[dir] returns all images in a directory.

Miscelaneous

BressenhamPoints[A,B] gives a list of the pixel-points on the line segment between A and B.

About

A library for functions related to multiple view geometry in Mathematica.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.