Safe Haskell | Safe-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.
- fillConnectedComponents :: Image GrayScale D8 -> (Image GrayScale D8, Int)
- maskConnectedComponent :: Image GrayScale D8 -> Int -> Image GrayScale D8
- selectSizedComponents :: Double -> Double -> Image GrayScale D8 -> Image GrayScale D8
- countBlobs :: Image GrayScale D8 -> Int
- spatialMoments :: Image GrayScale D32 -> Bool -> [Double]
- centralMoments :: Image GrayScale D32 -> Bool -> [Double]
- normalizedCentralMoments :: Image GrayScale D32 -> Bool -> [Double]
- huMoments :: Image GrayScale D32 -> Bool -> [Double]
- data Contours
- getContours :: Image GrayScale D8 -> Contours
- contourArea :: ContourFunctionUS Double
- contourPerimeter :: ContourFunctionUS Double
- contourPoints :: ContourFunctionUS [(Double, Double)]
- mapContours :: ContourFunctionUS a -> Contours -> [a]
- contourHuMoments :: ContourFunctionUS [Double]
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.
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