CV-0.3.5.3: OpenCV based machine vision library

Safe HaskellSafe-Infered

CV.Drawing

Contents

Description

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.

Synopsis

Drawable class

data ShapeStyle

Is the shape filled or just a boundary?

Constructors

Filled 
Stroked Int 

class Drawable a b where

Typeclass for images that support elementary drawing operations.

Associated Types

type Color a b :: *

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

Methods

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

 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 b

 Draw a line between two points.

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

 Draw a Circle

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

Draw a Rectangle by supplying two corners

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

 Draw a filled polygon

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

Extra drawing operations

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

Draw a polyline

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

 Draw C'CvBox2D

Floodfill operations

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

Flood fill a region of the image

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

 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 d

Apply circleOp to an image

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

 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)

Apply rectOp to an image

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

Apply fillPolyOp to an image