CV-0.3.7: OpenCV based machine vision library

Safe HaskellNone




Module for exposing opencv drawing functions. These are meant for quick and dirty marking and not for anything presentable. For any real drawing you should figure out how to use cairo or related package, such as diagrams. They are way better.

Consult the CV.ImageOp module for functions to apply the operations in this module to images.


Drawable class

data ShapeStyle Source

Is the shape filled or just a boundary?


Stroked Int 

class Drawable a b whereSource

Typeclass for images that support elementary drawing operations.

Associated Types

type Color a b :: *Source

 Type of the pixel, i.e. Float for a grayscale image and 3-tuple for RGB image.


putTextOp :: Color a b -> Float -> String -> (Int, Int) -> ImageOperation a bSource

 Put text of certain color to given coordinates. Good size seems to be around 0.5-1.5.

lineOp :: Color a b -> Int -> (Int, Int) -> (Int, Int) -> ImageOperation a bSource

 Draw a line between two points.

circleOp :: Color a b -> (Int, Int) -> Int -> ShapeStyle -> ImageOperation a bSource

 Draw a Circle

rectOp :: (BoundingBox bb, Integral (ELBB bb)) => Color a b -> Int -> bb -> ImageOperation a bSource

Draw a Rectangle by supplying two corners

fillPolyOp :: Color a b -> [(Int, Int)] -> ImageOperation a bSource

 Draw a filled polygon

ellipseOp :: Color a b -> Int -> (Int, Int) -> (Int, Int) -> Float -> (Float, Float) -> ImageOperation a bSource

Draw an ellipse or elliptic arc

ellipseBoxOp :: Color a b -> C'CvBox2D -> Int -> Int -> ImageOperation a bSource

Extra drawing operations

drawLinesOp :: Drawable c d => Color c d -> Int -> [((Int, Int), (Int, Int))] -> ImageOperation c dSource

Draw a line segments

drawPolyLineOp :: Drawable c d => Color c d -> Int -> [(Int, Int)] -> ImageOperation c dSource

Draw a polyline

drawBox2Dop :: Drawable c d => Color c d -> C'CvBox2D -> ImageOperation c dSource

 Draw C'CvBox2D

Floodfill operations

fillOp :: (Int, Int) -> D32 -> D32 -> D32 -> Bool -> ImageOperation GrayScale D32Source

Flood fill a region of the image

floodfill :: (Int, Int) -> D32 -> D32 -> D32 -> Bool -> Image GrayScale D32 -> Image GrayScale D32Source

 Apply fillOp to an image

Shorthand for drawing single shapes

circle :: Drawable c d => (Int, Int) -> Int -> Color c d -> ShapeStyle -> Image c d -> Image c dSource

Apply circleOp to an image

drawLines :: Drawable c d => Image c d -> Color c d -> Int -> [((Int, Int), (Int, Int))] -> IO (Image c d)Source

 Apply drawLinesOp to an image

rectangle :: (BoundingBox bb, Integral (ELBB bb), Drawable c d) => Color c d -> Int -> bb -> Image c d -> IO (Image c d)Source

Apply rectOp to an image

fillPoly :: Drawable c d => Color c d -> [(Int, Int)] -> Image c d -> IO (Image c d)Source

Apply fillPolyOp to an image