CV-0.3.5.3: OpenCV based machine vision library

Safe HaskellSafe-Infered

CV.Matrix

Description

This module provides wrappers for CvMat type. This is still preliminary as the type of the matrix isn't coded in the haskell type.

Synopsis

Documentation

class Exists a where

Associated Types

type Args a :: *

Methods

create :: Args a -> a

emptyMatrix :: Exists (Matrix a) => Args (Matrix a) -> Matrix a

Create an empty matrix of given dimensions

fromFunction :: (Storable t, Exists (Matrix t), Args (Matrix t) ~ (Int, Int)) => (Int, Int) -> ((Int, Int) -> t) -> Matrix t

Generate a matrix from a index function

fromList :: forall t. (Storable t, Exists (Matrix t), Args (Matrix t) ~ (Int, Int)) => (Int, Int) -> [t] -> Matrix t

toList :: Storable a => Matrix a -> [a]

 Convert a matrix to flat list (row major order)

toRows :: forall t. Storable t => Matrix t -> [[t]]

Convert matrix to rows represented as nested lists

toCols :: forall t. Storable t => Matrix t -> [[t]]

Convert matrix to cols represented as nested lists

get :: forall t. Storable t => Matrix t -> Int -> Int -> IO t

 Get an element of the matrix

put :: forall t. Storable t => Matrix t -> Int -> Int -> t -> IO ()

 Write an element to a matrix

withMatPtr :: Matrix x -> (Ptr C'CvMat -> IO a) -> IO a

transpose :: (Exists (Matrix a), Args (Matrix a) ~ Size (Matrix a)) => Matrix a -> Matrix a

Transpose a matrix. Does not do complex conjugation for complex matrices

mxm :: (Exists (Matrix a), Args (Matrix a) ~ Size (Matrix a)) => Matrix a -> Matrix a -> Matrix a

 Ordinary matrix multiplication

rodrigues2 :: (Exists (Matrix a), Args (Matrix a) ~ Size (Matrix a)) => Matrix a -> Matrix a

Convert a rotation vector to a rotation matrix (1x3 -> 3x3)