úÎ=Œ<%     tested on GHC only experimental#Noam Lewis <jones.noamle@gmail.com> The type of Processors The semantic model is:  " [[ Processor m o a b ]] = a -> b SThe idea is that the monad m is usually IO, and that a and b are usually pointers. S It is meant for functions that require a pre-allocated output pointer to operate. C a, b = the input and output types of the processor (think a -> b) + m = monad in which the processor operates  x = type of internal state &The arguments to the constructor are: V Processing function: Takes input and internal state, and returns new internal state. | Allocator for internal state (this is run only once): Takes (usually the first) input, and returns initial internal state. R Convertor from state x to output b: Takes internal state and returns the output. { Releaser for internal state (finalizer, run once): Run after processor is done being used, to release the internal state. 7Chains two processors serially, so one feeds the next. jA processor that represents two sub-processors in parallel (although the current implementation runs them 2 sequentially, but that may change in the future) jConstructs a processor that: given two processors, gives source as input to both processors and runs them S independently, and after both have have finished, outputs their combined outputs. Semantic meaning, using Arrow's (&&& ) operator:  [[ forkJoin ]] = &&& c Or, considering the Monad instance of functions (which are the semantic meanings of a processor):  [[ forkJoin ]] = liftM2 (,) + Alternative implementation to consider: f &&& g = (,)  & f  * g ?The identity processor: output = input. Semantically, [[ empty ]] = id JSplits (duplicates) the output of a functor, or on this case a processor. 'f --< g'H means: split f and feed it into g. Useful for feeding parallelized (***'d) processors.  For example, a --< (b &&& c) TRuns the processor once: allocates, processes, converts to output, and deallocates. YKeeps running the processing function in a loop until a predicate on the output is true. \ Useful for processors whose main function is after the allocation and before deallocation. ^Runs the processor once, but passes the processing + conversion action to the given function. A few tricks by Saizan from #haskell to perhaps use here:  first f = (,)  $ (arr fst >>> f)  * arr snd  arr f = f  $ id  f *** g = (arr fst >>> f) &&& (arr snd >>> g)    tested on GHC only experimental#Noam Lewis <jones.noamle@gmail.com> BSome general utility functions for use with Processors and OpenCV Predicate for pressed keys cRuns the processor until a predicate is true, for predicates, and processors that take () as input , (such as chains that start with a camera). Name (and type) says it all. A capture device, using OpenCV' s HighGui lib's cvCreateCameraCapture + should work with most webcames. See OpenCV's docs for information. M This processor outputs the latest image from the camera at each invocation. A window that displays images. J Note: windows with the same index will be the same window....is this ok? dA convenience function for constructing a common type of processors that work exclusively on images OpenCV' s cvResize OpenCV' s cvDilate OpenCV's cvCanny  Threshold 1  Threshold 2 Size Wrapper for OpenCV'_s cvHaarDetectObjects and the surrounding required things (mem storage, cascade loading, etc). PCascade filename (OpenCV comes with several, including ones for face detection) scale factor min neighbors flags  min size OpenCV'Cs cvRectangle, currently without width, color or line type control         cv-combinators-0.1AI.CV.ProcessorAI.CV.ImageProcessors Processor processorchainparallelforkJoinemptysplit--<runrunUntilrunWithImageProcessor ImageSource ImageSink keyPressedrunTillrunTillKeyPressedcamerawindowimageProcessorresizedilatecanny haarDetect drawRects$fArrowProcessor