CV-0.3.5.3: OpenCV based machine vision library

Safe HaskellSafe-Infered

CV.ConnectedComponents

Contents

Description

This module contains functions for extracting features from connected components of black and white images as well as extracting other shape related features.

Synopsis

Working with connected components

selectSizedComponents :: Double -> Double -> Image GrayScale D8 -> Image GrayScale D8

Remove all connected components that fall outside of given size range from the image.

countBlobs :: Image GrayScale D8 -> Int

Count the number of connected components in the image

Working with Image moments

Note that these functions should probably go to a different module, since they deal with entire moments of entire images.

spatialMoments :: Image GrayScale D32 -> Bool -> [Double]

Extract raw spatial moments of the image.

centralMoments :: Image GrayScale D32 -> Bool -> [Double]

Extract central moments of the image. These are useful for describing the object shape for a classifier system.

normalizedCentralMoments :: Image GrayScale D32 -> Bool -> [Double]

Extract normalized central moments of the image.

huMoments :: Image GrayScale D32 -> Bool -> [Double]

Extract Hu-moments of the image. These features are rotation invariant.

Working with component contours aka. object boundaries.

This part is really old code and probably could be improved a lot.

data Contours

Structure that contains the opencv sequence holding the contour data.

getContours :: Image GrayScale D8 -> Contours

Extract contours of connected components of the image.

contourArea :: ContourFunctionUS Double

The area of a contour.

contourPerimeter :: ContourFunctionUS Double

Get the perimeter of a contour.

contourPoints :: ContourFunctionUS [(Double, Double)]

Get a list of the points in the contour.

mapContours :: ContourFunctionUS a -> Contours -> [a]

This function maps an opencv contour calculation over all contours of the image.

contourHuMoments :: ContourFunctionUS [Double]

 Operation for extracting Hu-moments from a contour