Portability | tested on GHC only |
---|---|
Stability | experimental |
Maintainer | Noam Lewis <jones.noamle@gmail.com> |
ImageProcessors is a functional (Processor-based) interface to computer vision using OpenCV.
The Processor interface allows the primitives in this library to take care of all the allocation / deallocation of resources and other setup/teardown requirements, and to appropriately nest them when combining primitives.
Simple example:
win = window 0 -- The number is essentially a label for the window cam = camera 0 -- Autodetect camera edge = canny 30 190 3 -- Edge detecting processor using canny operator test = win . edge . cam -- A processor that captures frames from camera and displays edge-detected version in the window.
- type ImageSink = Processor IO (Ptr IplImage) ()
- type ImageSource = Processor IO () (Ptr IplImage)
- type ImageProcessor = Processor IO (Ptr IplImage) (Ptr IplImage)
- keyPressed :: Show a => a -> IO Bool
- runTill :: Monad m => Processor m () b -> (b -> m Bool) -> m b
- runTillKeyPressed :: Show a => Processor IO () a -> IO ()
- camera :: Int -> ImageSource
- window :: Int -> ImageSink
- imageProcessor :: (Ptr IplImage -> Ptr IplImage -> IO (Ptr IplImage)) -> (Ptr IplImage -> IO (Ptr IplImage)) -> ImageProcessor
- resize :: Int -> Int -> InterpolationMethod -> ImageProcessor
- dilate :: Int -> ImageProcessor
- canny :: Int -> Int -> Int -> ImageProcessor
- haarDetect :: String -> Double -> Int -> HaarDetectFlag -> CvSize -> Processor IO (Ptr IplImage) [CvRect]
- drawRects :: Processor IO (Ptr IplImage, [CvRect]) (Ptr IplImage)
Documentation
keyPressed :: Show a => a -> IO BoolSource
Some general utility functions for use with Processors and OpenCV
Predicate for pressed keys
runTill :: Monad m => Processor m () b -> (b -> m Bool) -> m bSource
Runs the processor until a predicate is true, for predicates, and processors that take () as input (such as chains that start with a camera).
camera :: Int -> ImageSourceSource
A capture device, using OpenCV's HighGui lib's cvCreateCameraCapture should work with most webcames. See OpenCV's docs for information. This processor outputs the latest image from the camera at each invocation.
window :: Int -> ImageSinkSource
A window that displays images. Note: windows with the same index will be the same window....is this ok?
imageProcessor :: (Ptr IplImage -> Ptr IplImage -> IO (Ptr IplImage)) -> (Ptr IplImage -> IO (Ptr IplImage)) -> ImageProcessorSource
A convenience function for constructing a common type of processors that work exclusively on images
resize :: Int -> Int -> InterpolationMethod -> ImageProcessorSource
OpenCV's cvResize
dilate :: Int -> ImageProcessorSource
OpenCV's cvDilate
:: String | Cascade filename (OpenCV comes with several, including ones for face detection) |
-> Double | scale factor |
-> Int | min neighbors |
-> HaarDetectFlag | flags |
-> CvSize | min size |
-> Processor IO (Ptr IplImage) [CvRect] |
Wrapper for OpenCV's cvHaarDetectObjects and the surrounding required things (mem storage, cascade loading, etc).