Safe Haskell | Safe-Infered |
---|

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.

- data ShapeStyle
- class Drawable a b where
- type Color a b :: *
- putTextOp :: Color a b -> Float -> String -> (Int, Int) -> ImageOperation a b
- lineOp :: Color a b -> Int -> (Int, Int) -> (Int, Int) -> ImageOperation a b
- circleOp :: Color a b -> (Int, Int) -> Int -> ShapeStyle -> ImageOperation a b
- rectOp :: (BoundingBox bb, Integral (ELBB bb)) => Color a b -> Int -> bb -> ImageOperation a b
- fillPolyOp :: Color a b -> [(Int, Int)] -> ImageOperation a b
- ellipseBoxOp :: Color a b -> C'CvBox2D -> Int -> Int -> ImageOperation a b

- drawLinesOp :: Drawable c d => Color c d -> Int -> [((Int, Int), (Int, Int))] -> ImageOperation c d
- drawBox2Dop :: Drawable c d => Color c d -> C'CvBox2D -> ImageOperation c d
- fillOp :: (Int, Int) -> D32 -> D32 -> D32 -> Bool -> ImageOperation GrayScale D32
- floodfill :: (Int, Int) -> D32 -> D32 -> D32 -> Bool -> Image GrayScale D32 -> Image GrayScale D32
- circle :: Drawable c d => (Int, Int) -> Int -> Color c d -> ShapeStyle -> Image c d -> Image c d
- drawLines :: Drawable c d => Image c d -> Color c d -> Int -> [((Int, Int), (Int, Int))] -> IO (Image c d)
- rectangle :: (BoundingBox bb, Integral (ELBB bb), Drawable c d) => Color c d -> Int -> bb -> Image c d -> IO (Image c d)
- fillPoly :: Drawable c d => Color c d -> [(Int, Int)] -> Image c d -> IO (Image c d)

# Drawable class

data ShapeStyle Source

Is the shape filled or just a boundary?

class Drawable a b whereSource

Typeclass for images that support elementary drawing operations.

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

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 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