Permalink
Browse files

Maximal covering circle example

  • Loading branch information...
Ville Tirronen
Ville Tirronen committed Mar 22, 2011
1 parent 0057a35 commit 2b0cd86864af5e95c5723301b6dd7d855799534b
Showing with 20 additions and 0 deletions.
  1. +20 −0 examples/maximalCC.hs
View
@@ -0,0 +1,20 @@
+{-#LANGUAGE ParallelListComp,ScopedTypeVariables#-}
+module Main where
+import CV.Image
+import CV.Drawing
+import CV.ImageOp
+import CV.Transforms
+import qualified CV.ImageMath as IM
+
+main = do
+ let s :: Image GrayScale D32
+ s = empty (300,300) <# circleOp 1 (150,150) 40 Filled
+ dtf = distanceTransform CV_DIST_L2 M3 (unsafeImageTo8Bit s)
+ testCircle = (170,160,10)
+ (mx,my,r) = IM.maximalCoveringCircle dtf testCircle
+
+ saveImage "cover.png" $ montage (3,1) 2
+ [s
+ ,(unsafeImageTo32F s) <# circleOp 0 (170,160) 10 Filled
+ ,empty (300,300) <# circleOp 1 (mx,my) (round r) (Stroked 2) ]
+

0 comments on commit 2b0cd86

Please sign in to comment.