Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
8921606
New support for OpenCV 2.1.
Jul 30, 2010
03b7ec3
Added a Haskell data type that wraps up IplImage.
Jul 30, 2010
b33b18b
Improved ease of use HIplImage as a gateway to OpenCV operations.
Jul 30, 2010
7090e4c
Added a script for generating the color conversion hsc2hs enum macro.
Aug 2, 2010
5baa9ae
Removed the nSize filed of HIplImage and renamed nChannels to numChan…
Aug 2, 2010
2c587a7
Moving high-level pure-Haskell interfaces to the HCV module.
Aug 3, 2010
8ad0523
Wrapped loading and saving images and drawing lines.
Aug 3, 2010
b6d43cd
Added the HCV module that provides the functional interface to variou…
Aug 3, 2010
a3532cb
Added the color conversion enumeration.
Aug 3, 2010
67c8cda
Renamed HCV.hs to HighCV.hs
Aug 3, 2010
3aabf43
Exposed high-level color conversion.
Aug 3, 2010
5efb4f2
Fixed cvSaveImage wrapper. Changed unsafe operations to use ST.
Aug 4, 2010
a6bca8d
Removed export of unsafeDrawLines.
Aug 4, 2010
c8c85bd
Changed to using a type annotation to indicate image allocation.
Aug 4, 2010
32e3201
Added comment for the FreshImage type tag.
Aug 4, 2010
7a31ace
Added copying conversions between HIplImage and Vector.
Aug 4, 2010
8d86a36
Added initial support for cvFindContours.
Aug 5, 2010
ace3a93
Working on Contour extraction. Not done yet.
Aug 5, 2010
3884e8a
Statically typed color model of images.
Aug 5, 2010
5e63806
Marked Vector-using functions INLINE.
Aug 5, 2010
4034715
Updated README file.
Aug 5, 2010
2c11e4f
Refactoring into two new modules.
Aug 5, 2010
874a91e
Added the packPixels function.
Aug 5, 2010
4fdda67
Added support for cvSampleLine.
Aug 6, 2010
6ed2f1e
Added a .gitignore file.
Aug 6, 2010
9cd08fa
Added a file existence check to the fromFile* functions.
Aug 7, 2010
b4fcb6c
Wrapped Canny edge detection up into HighCV.
Aug 7, 2010
6a672f1
Wrapped cvCalcOpticalFlowBM.
Aug 13, 2010
6593e13
Added the actual cvCalcOpticalFlowBM wrapper implementation.
Aug 13, 2010
52a1cec
Extracted findContours into its own module.
Aug 16, 2010
102cd69
Added image thresholding operations.
Aug 16, 2010
4a31671
Added an unsafeCanny destructive update rewrite rule.
Aug 17, 2010
d17dee4
Generalized the cvQueryFrame error message.
Aug 17, 2010
ff81dd3
Cleaned up some syntax in HighGui.
Aug 17, 2010
0ca8458
Explicitly made video file playback loop.
Aug 18, 2010
6effe80
Added Gaussian smoothing.
Aug 19, 2010
39639f1
Added convertScale. Improved smoothGaussian usability.
Aug 20, 2010
28e5b53
Added Harris corner detector.
Aug 20, 2010
4ff84c2
Added cvAnd. This is still under development.
Aug 20, 2010
5ae025c
Prevent unsafe inlining. Changed queryFrame interface to return a Maybe.
Aug 24, 2010
f65e699
Added an example of morphological closing.
Aug 24, 2010
8b1d818
Removed old test directory.
Aug 24, 2010
86ea3a9
Added note about optimizations to README.
Aug 24, 2010
883141a
Moved low-level modules into the Core directory.
Aug 24, 2010
0695bf0
Added CvVideoWriter support.
Aug 25, 2010
35e3950
Added type checking for operations that utilize a scalar with an image.
Aug 25, 2010
6bd4958
Changed threshold interface to have separate functions for inverted t…
Aug 25, 2010
5240261
Added cvMul, cvAdd, and getROI. Allow threshold to change pixel type.
Aug 25, 2010
55e2780
Compacted class constraints.
Aug 30, 2010
bd36e5f
Normalized to using unsafePerformIO wherever it is necessary.
Aug 30, 2010
abd51da
Normalized all unsafe rewrites to use the pipeline function.
Aug 30, 2010
9a31eac
Converted unsafe operations to live in IO. pipeline does the cast.
Aug 30, 2010
e26ed72
Added build instructions for Windows.
Aug 31, 2010
8ec78c8
Added synonyms for grayscale and color 8-bit images.
Aug 31, 2010
50a1772
Improved the in-place mutation deforestation mechanisms.
Sep 1, 2010
dc7b92e
Tweaked INLINE phase for thresholdBinary.
Sep 2, 2010
f55d39d
Added the floodFill function.
Sep 4, 2010
163abf7
Updated vector version.
Nov 18, 2010
c43abcc
Updated cvHaarDetectObjects wrapper for OpenCV 2.2
Dec 17, 2010
578b83f
Updates to OpenCV 2.2 support with new split header files. Added wind…
Feb 5, 2011
ca4dc65
Added keyboard callback to namedWindow.
Feb 5, 2011
c84b217
Fixed linking with OpenCV 2.2 libraries. Updated several header refer…
Feb 5, 2011
7b58422
Updated a couple more includes. Where is the C API for the video modu…
Feb 5, 2011
623c64e
Put color conversion back in IO.
Feb 10, 2011
bb61ee3
Added 16-bit PGM loading since OpenCV doesn't support it properly.
Feb 10, 2011
8fc85bd
Export HIplImage accessors from HIplUtils so it is a useful "low-leve…
Feb 10, 2011
f9a76fa
Removed duplicate export from HIplUtils.
Feb 11, 2011
45f7de0
Fixed byte ordering bug with 16-bit PGM loading.
Feb 18, 2011
b28dac5
Updated vector-space version dependency.
Feb 24, 2011
e4ffd1a
Added names for de-Bayering to RGB and BGR.
Apr 21, 2011
4467d6c
Added Canny edge detector.
Apr 25, 2011
c7600dc
Renamed HIplUtils to HIplUtil. Added overloaded fromFile.
May 24, 2011
f6ab941
Start pushing the CVOp fusion abstraction through.
May 24, 2011
fe55198
Changed FFI calls to safe.
May 26, 2011
ea112d1
Fixed fusion of convertScale. Made cvSubMask confusing to use but mor…
May 26, 2011
4aba620
Updated Threshold module with CVOp.
May 26, 2011
68f8981
Extracted the Video module.
May 26, 2011
f7630c4
Export Word8 and Word16 from HighCV. Added contrastBoost to CamCanny.
May 27, 2011
6f09586
Took out the unused mouse callback argument to namedWindow.
May 27, 2011
8c5793a
Added a more granular performance counter that can be used to selecti…
May 28, 2011
acf091c
Wrapped some more array operations: cmpS, avg, avgMask, not.
May 28, 2011
ed0b5d0
Made cv and cv2 polymorphic in the kind of Ptr they work with.
Jun 1, 2011
5d2ea3f
Added the PerfTest module for checking performance using Criterion.
Jun 1, 2011
333d758
Added VideoFunhouse example of realtime image processing.
Jun 1, 2011
0dc0116
Updated README and .cabal file.
Jun 1, 2011
9ef7f63
Dead code removal.
Jun 1, 2011
d3b4895
Set a more reasonable version number after the big upgrade.
Jun 2, 2011
16ad938
Added VideoFunhouse support for reading a video file.
Jun 2, 2011
0092e9e
Added usage instructions given --help argument.
Jun 2, 2011
a500767
Dead code removal and minor reformatting.
Jun 2, 2011
d572ccc
Code cleanup. Thanks hlint!
Jun 2, 2011
93d46c5
Fixed accidental restriction of fusion opportunities.
Jun 3, 2011
8545e2a
Documentation improvements.
Jun 3, 2011
6d65063
Added a comment clarification about frame rate display to VideoFunhouse.
Jun 3, 2011
6109e4d
Mask out upper 16 bits of cvWaitKey return value to discard shift/eve…
Jun 9, 2011
98fde66
Add support for linking against OpenCV 2.1 using a cabal flag.
Jun 9, 2011
75bd3fd
Fixed Windows library names.
Jun 10, 2011
5571d4c
Updated notes about Windows compatibility.
Jun 10, 2011
7b740f9
Added equalizeHist in the Histograms module.
Jul 20, 2011
5e34cd2
Added HSV color conversions.
Jul 20, 2011
e609a03
Added isolateChannel and replaceChannel.
Jul 20, 2011
b444828
Added saturation boost effect to VideoFunhouse.
Jul 20, 2011
85e2e64
Improved README wording.
Jul 20, 2011
c7a3ca0
Added ROI existence to image type to aid in static dispatching to ROI…
Jul 20, 2011
92a5560
Added array copy (useful with ROI).
Jul 20, 2011
ccb81c0
Added the centralFocus video effect.
Jul 20, 2011
eaf15d1
Widespread renaming: MonoChromatic -> Monochromatic; TriChromatic -> …
Jul 21, 2011
3a781e0
Added support for Int16 images and Sobel filtering.
Jul 22, 2011
4bf1885
Added libopencv_video to extra-libraries.
Jul 29, 2011
90e6747
Added fillConvexPoly
Aug 10, 2011
680f999
Added a flag to control the export of optical flow bindings. These bi…
Aug 20, 2011
c134f3c
Fixed several FFI bugs exposed on 64bit builds.
Jan 3, 2012
134153b
Explicitly import constructors of types used in foreign imports to ad…
acowley Mar 13, 2012
adab0de
Conditional compilation to avoid redifining the Monoid append operato…
acowley Mar 13, 2012
8dc9dc8
Added a 'numPixels' accessor for images.
acowley Mar 13, 2012
49fa8a5
Removed dependency on allocated-processor package.
acowley Mar 13, 2012
97c6a61
Updated notice of OpenCV compatibility with 2.3.1 in README.
acowley Mar 13, 2012
5c66a83
Added Storable utility module.
acowley Mar 15, 2012
62f5a82
Moved files.
acowley Sep 19, 2012
6d631ca
Fixed module names.
acowley Sep 19, 2012
0a92981
Replaced HIplImage with Image.
acowley Sep 20, 2012
d195556
Switched over to DataKinds and new Image type.
acowley Sep 21, 2012
de51e2e
Bumped base dependency to 4.6.
acowley Sep 21, 2012
5a34f78
Some API renaming. Mutable image dup helper.
acowley Sep 21, 2012
cfe835c
Added helpers for working with 8bpp RGB pixels.
acowley Sep 25, 2012
6a4c6cb
Fixed a comment bug.
acowley Oct 12, 2012
59a7f3f
Small code simplification.
acowley Oct 12, 2012
ded391b
Restrict cv2 INLINE phase.
acowley Nov 29, 2012
95add59
Fixed pixelVector.
acowley Nov 30, 2012
8557b99
Improved withPixelVector usability.
acowley Dec 5, 2012
0ad8f8f
Fixed bug in peeking an IplImage.
acowley Sep 7, 2013
ed52fec
use a wrapper for cvCreateVideoWriter using cvSize
aavogt Sep 7, 2013
58b9c56
Merge github.com:aavogt/HOpenCV
aavogt Sep 7, 2013
8f6bfec
Merge pull request #1 from aavogt/master
acowley Sep 7, 2013
140812f
Export low-level convertColor function.
acowley Sep 7, 2013
f6cac75
Add FourCC code helper.
acowley Sep 7, 2013
77ed62b
Added VideoWriter example.
acowley Sep 9, 2013
eccecae
working contouring
aavogt May 1, 2014
2eeaa3f
createVideoWriter should not accept Monochrome images
aavogt May 7, 2014
4c0e5d3
Merge pull request #2 from aavogt/master
acowley May 7, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dist
*_hsc.c
*_hsc.h
*.hi
*.o

122 changes: 76 additions & 46 deletions HOpenCV.cabal
Original file line number Diff line number Diff line change
@@ -1,63 +1,93 @@
name: HOpenCV
version: 0.1.2.2
version: 0.4.0
license: BSD3
maintainer: Noam Lewis <jones.noamle@gmail.com>
bug-reports: mailto:jones.noamle@gmail.com
author: Noam Lewis <jones.noamle@gmail.com>
maintainer: Anthony Cowley <acowley@gmail.com>
stability: experimental
category: AI, Graphics
synopsis: A binding for the OpenCV computer vision library
Tested-With: GHC == 6.10.4
synopsis: A binding for the OpenCV computer vision library.
Tested-With: GHC==7.6.1
description:
Initial version with very limited bindings to OpenCV 2.0. (See: <http://opencv.willowgarage.com/wiki/Welcome>)
.
For a functional interface to this library, see the package "cv-combinators".
.
Online module documentation, if not build below, can be found at <http://www.ee.bgu.ac.il/~noamle/>.
Limited bindings to OpenCV 2.4. (See: <http://opencv.willowgarage.com/wiki/Welcome>)
.
/Installation/
.
You must install OpenCV (development packages) prior to installing this package. Currently only tested on Ubuntu Linux, but should work on most linux distributions. For OpenCV installation on other *nix platforms, see <http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.0/>
.
On /Ubuntu/ systems, the appropriate version of OpenCV can be installed by (the instructions are for Karmic):
You must install OpenCV (development packages) prior to installing this package. Currently tested on Mac OS 10.7.
.
> sudo add-apt-repository ppa:gijzelaar/opencv2-karmic
> sudo apt-get update
> sudo apt-get install libcv-dev libhighgui-dev
/Usage/
.
You should then have libcv4 and libhighgui4 installed automatically too.
The "OpenCV.HighCV" module exposes the most commonly used functionality. The @Core@ modules contain to low-level OpenCV interfaces, while modules not in the @Core@ directory provide specific types of operations.
.

build-type: Simple
cabal-version: >= 1.2
extra-source-files:
src/AI/CV/OpenCV/HOpenCV_wrap.h
See @src\/Examples\/VideoFunhouse@ for an example application.
build-type: Custom
cabal-version: >= 1.8
extra-source-files: src/OpenCV/Core/HOpenCV_wrap.h
src/Examples/VideoFunhouse/Makefile
src/Examples/VideoFunhouse/Rate.hs
src/Examples/VideoFunhouse/VideoFunhouse.hs
src/Examples/Closing/Closing.hs
source-repository head
type: git
location: git://github.com/acowley/HOpenCV.git

Flag OpenCV21
Description: Link against OpenCV 2.1
Default: False

Flag MotionAnalysis
Description: Export optical flow bindings. Doesn't work with GHCi.
Default: False

library
exposed-modules:
AI.CV.OpenCV.CV
AI.CV.OpenCV.CxCore
AI.CV.OpenCV.HighGui
AI.CV.OpenCV.Types
OpenCV.Core.CV
OpenCV.Core.CVOp
OpenCV.Core.CxCore
OpenCV.Core.HighGui
OpenCV.Core.Image
OpenCV.Core.ImageUtil
OpenCV.Core.ColorConversion
OpenCV.HighCV
OpenCV.GUI
OpenCV.Video
OpenCV.FloodFill
OpenCV.PixelUtils
OpenCV.ColorConversion
OpenCV.Drawing
OpenCV.Contours
OpenCV.Threshold
OpenCV.ArrayOps
OpenCV.Filtering
OpenCV.FeatureDetection
OpenCV.Histograms
OpenCV.Color
c-sources:
src/AI/CV/OpenCV/HOpenCV_wrap.c
src/OpenCV/Core/HOpenCV_wrap.c
src/OpenCV/ArrayOps_hsc.c
src/OpenCV/FloodFill_hsc.c
src/OpenCV/Drawing_hsc.c
other-modules: OpenCV.Core.StorableUtil
hs-Source-Dirs: src
include-dirs: /usr/include/opencv
extra-libraries: cv,highgui
build-depends: base >=4 && <5, allocated-processor >= 0.0.1, vector-space
ghc-options: -Wall -fno-warn-type-defaults

executable test-hopencv
c-sources:
src/AI/CV/OpenCV/HOpenCV_wrap.c
include-dirs: /usr/include/opencv
hs-source-dirs: src
Build-Depends: base >=4 && <5
main-is: Test.hs
Ghc-Options: -Wall -fno-warn-type-defaults
Ghc-Prof-Options: -prof -auto-all
extra-libraries: cv,highgui
other-modules: AI.CV.OpenCV.CxCore, AI.CV.OpenCV.CV, AI.CV.OpenCV.HighGui, AI.CV.OpenCV.Types
if flag(MotionAnalysis)
exposed-modules: OpenCV.Motion
if os(windows)
include-dirs: C:\\OpenCV2.2\\include
extra-lib-dirs: C:\\OpenCV2.2\\bin
extra-libraries: opencv_core220,opencv_imgproc220,opencv_highgui220,opencv_video220
else
if flag(OpenCV21)
CC-Options: "-DOCV21"
extra-libraries: cv highgui
else
extra-libraries: opencv_core,opencv_imgproc,opencv_highgui,opencv_video

-- needed to load in ghci-7.8
cc-options: -fPIC

--source-repository head
-- type: git
-- location: git://github.com/sinelaw/HOpenCV.git
build-depends: base >= 4.6 && <5,
template-haskell,
vector-space >= 0.7.2,
directory >= 1.0.1.0 && < 2,
vector >= 0.7,
singletons, tagged
ghc-options: -Wall -fno-warn-name-shadowing -O2 -funbox-strict-fields
15 changes: 0 additions & 15 deletions README

This file was deleted.

24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# HOpenCV

[OpenCV](http://opencv.willowgarage.com/wiki/) bindings for Haskell
(tested with OpenCV 2.1, 2.2, 2.3.0, and 2.3.1).

- Image color channel count and color depth are statically checked.

- A functional interface is provided through the HighCV module.

- When operations are directly composed, they will be performed
in-place where possible as the intermediate images are not
observable. GHC's optimizations must be enabled (e.g. -O2).

- See
[src/Examples](https://github.com/acowley/HOpenCV/tree/master/src/Examples)
for example programs. In particular, the
[VideoFunhouse](https://github.com/acowley/HOpenCV/tree/master/src/Examples/VideoFunhouse)
executable demonstrates realtime image processing on either the
video feed from a webcam or a video file. Fusion of in-place
operations is demonstrated along with light-weight parallelism.

NOTE: Only a small part of OpenCV is currently wrapped.


20 changes: 20 additions & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Data.List (intercalate)
import Distribution.Simple
import System.Cmd
import System.Exit
import System.FilePath

libs :: [String]
libs = ["opencv_core", "opencv_imgproc", "opencv_highgui", "opencv_video"]

runHsc2hs :: FilePath -> IO ExitCode
runHsc2hs f = system $ "hsc2hs "++f++" "++libs'
where libs' = intercalate " " $ map ("-L -l"++) libs

srcPath :: FilePath
srcPath = "src/OpenCV"

main :: IO ()
main = do mapM_ (runHsc2hs . (srcPath </>) . flip addExtension "hsc")
["ArrayOps", "FloodFill", "Drawing"]
defaultMain
92 changes: 0 additions & 92 deletions src/AI/CV/OpenCV/CV.hsc

This file was deleted.

Loading