Skip to content

Commit

Permalink
ok compvis
Browse files Browse the repository at this point in the history
  • Loading branch information
albertoruiz committed Dec 26, 2011
1 parent f9497a3 commit 6b6cf76
Show file tree
Hide file tree
Showing 45 changed files with 115 additions and 114 deletions.
1 change: 0 additions & 1 deletion README

This file was deleted.

6 changes: 4 additions & 2 deletions INSTALL → README.md
@@ -1,5 +1,7 @@
Tested on Ubuntu x86
--------------------
installation instructions
-------------------------

(Tested on Ubuntu x86)

1. Install the Haskell Platform (we need ghc and cabal-install) and run:

Expand Down
2 changes: 1 addition & 1 deletion compvis/classify/catalog.hs
@@ -1,6 +1,6 @@
import EasyVision
import Graphics.UI.GLUT
import System(getArgs)
import System.Environment(getArgs)
import Util.Options

main = do
Expand Down
6 changes: 3 additions & 3 deletions compvis/classify/classifier.hs
Expand Up @@ -87,11 +87,11 @@ worker cam w = do
-----------------------------------------------------

mouse _ st (MouseButton LeftButton) Down _ _ = do
(_,ps,m) <- get st
st $= (True,ps,m)
(_,ps,m) <- getW st
putW st (True,ps,m)

mouse _ st (Char 'f') Down _ _ = do
(_,ps,_) <- get st
(_,ps,_) <- getW st
sv <- openYUV4Mpeg (size $ rgb $ fst $ head $ ps) "catalog.yuv" Nothing
mapM_ (sv.yuv.fst) ps
writeFile "catalog.labels" $ unlines $ [show n ++"\t"++l | (n,l) <- zip [1..length ps] (map snd ps)]
Expand Down
4 changes: 2 additions & 2 deletions compvis/classify/ipclassifier.hs
Expand Up @@ -83,8 +83,8 @@ distv a b = norm (a-b)

-- click to add a new object
mouse _ st (MouseButton LeftButton) Down _ _ = do
(_,ps) <- get st
st $= (True,ps)
(_,ps) <- getW st
putW st (True,ps)

mouse def _ a b c d = def a b c d

4 changes: 2 additions & 2 deletions compvis/classify/lbpclassifier.hs
Expand Up @@ -69,8 +69,8 @@ vector v = fromList v :: Vector Double

-- click to add a new object
mouse _ st (MouseButton LeftButton) Down _ _ = do
(_,ps) <- get st
st $= (True,ps)
(_,ps) <- getW st
putW st (True,ps)

mouse def _ a b c d = def a b c d

Expand Down
2 changes: 1 addition & 1 deletion compvis/classify/roiclass.hs
Expand Up @@ -10,7 +10,7 @@ $ ./roiclass 'newvideo -benchmark' selectedtest selected1 selected2 etc.
import EasyVision
import Graphics.UI.GLUT hiding (histogram)
import Control.Monad(when)
import System(getArgs)
import System.Environment(getArgs)
import qualified Data.Colour.Names as Col
import Numeric.LinearAlgebra
import Classifier
Expand Down
12 changes: 6 additions & 6 deletions compvis/classify/roisel.hs
Expand Up @@ -11,7 +11,7 @@ $ ./roisel selected
import EasyVision
import Graphics.UI.GLUT
import Control.Monad(when)
import System(getArgs)
import System.Environment(getArgs)
import qualified Data.Colour.Names as Col
import Util.Options

Expand Down Expand Up @@ -52,7 +52,7 @@ main1 = do
putW w False

mouse _ st (Char 's') Down _ _ = do
st $~ not
updateW st not

mouse def _ a b c d = def a b c d

Expand Down Expand Up @@ -85,11 +85,11 @@ seeRois imgs rois = evWindow 0 "Selected ROI" (mpSize 20) (Just disp) (mouse kbd
drawROI (rois!!k)
text2D 50 50 (show $ k+1)
mouse _ st (MouseButton WheelUp) Down _ _ = do
k <- get st
st $= min (k+1) (length imgs -1)
k <- getW st
putW st $ min (k+1) (length imgs -1)
postRedisplay Nothing
mouse _ st (MouseButton WheelDown) Down _ _ = do
k <- get st
st $= max (k-1) 0
k <- getW st
putW st $ max (k-1) 0
postRedisplay Nothing
mouse def _ a b c d = def a b c d
2 changes: 0 additions & 2 deletions compvis/contours/canonic.hs
Expand Up @@ -363,8 +363,6 @@ monitorOrient = monitor "contours" (mpSize 20) sh where
-- show canonic versions of shapes and other interesting info


runIt f = prepare >> f >> mainLoop

showpentoR = examplesBrowser "pentominos" (EV.Size 500 500) f pentominos
where
f = shcontO . transPol (diagl[0.1,0.1,1])
Expand Down
2 changes: 0 additions & 2 deletions compvis/contours/testShapes.hs
Expand Up @@ -48,8 +48,6 @@ isBlack x = orientedArea x < 0

----------------------------------------------------------------------

runIt f = prepare >> f >> mainLoop

showDigits = runIt $ do
--ds <- return pentominos
ds <- (read <$> readFile "../../data/shapes/letters.txt")
Expand Down
4 changes: 2 additions & 2 deletions compvis/gpu/matches-sift.hs
Expand Up @@ -178,8 +178,8 @@ boxFeat p = do


mouse _ st (MouseButton LeftButton) Down _ _ = do
(_,_) <- get st
st $= ([],undefined)
(_,_) <- getW st
putW st ([],undefined)
mouse def _ a b c d = def a b c d

distv a b = pnorm PNorm2 (a-b)
4 changes: 2 additions & 2 deletions compvis/gpu/sift-classify.hs
Expand Up @@ -117,8 +117,8 @@ pixelsOfROI (ROI r1 r2 c1 c2) =

-- click to add a new object
mouse _ st (MouseButton LeftButton) Down _ _ = do
(_,ps) <- get st
st $= (True,ps)
(_,ps) <- getW st
putW st (True,ps)

mouse def _ a b c d = def a b c d

Expand Down
10 changes: 5 additions & 5 deletions compvis/pano/autopano.hs
Expand Up @@ -93,17 +93,17 @@ findRot a b pi ti ri = fst $ minimize NMSimplex2 1E-3 10 [0.1*degree, 0.1*degree

-- click to adjust
mouse _ st (MouseButton LeftButton) Down _ _ = do
(_,p) <- get st
st $= (True,p)
(_,p) <- getW st
putW st (True,p)

-- restart from identity
mouse _ st (Char 'z') Down _ _ = do
st $= (True,[0,0,0])
putW st (True,[0,0,0])

-- end optimization
mouse _ st (Char 'o') Down _ _ = do
(_,p) <- get st
st $= (False,p)
(_,p) <- getW st
putW st (False,p)


mouse def _ a b c d = def a b c d
2 changes: 1 addition & 1 deletion compvis/pano/single.hs
Expand Up @@ -70,7 +70,7 @@ worker vcam cam w p = do
times n f = (!!n) . iterate f

mouse _ st (MouseButton LeftButton) Down _ _ = do
st $= Nothing
putW st Nothing

mouse def _ a b c d = def a b c d

Expand Down
1 change: 1 addition & 0 deletions compvis/pose/dynamic.hs
Expand Up @@ -4,6 +4,7 @@
module Main where

import EasyVision as EV
import EasyVision.GUI.OldGUI
import ImagProc.C.Segments
import System.Environment(getArgs)
import qualified Data.Map as Map
Expand Down
1 change: 1 addition & 0 deletions compvis/pose/frontal.hs
Expand Up @@ -15,6 +15,7 @@
module Main where

import EasyVision hiding (camera)
import EasyVision.GUI.OldGUI
import ImagProc.Ipp.Core(image,ImageFloat(F),fullroi,setData32f)
import Graphics.UI.GLUT hiding (Matrix, Size, Point)
import Data.IORef
Expand Down
6 changes: 3 additions & 3 deletions compvis/pose/multipose.hs
Expand Up @@ -164,16 +164,16 @@ weighted alpha (f1,r1,c1) (f2,r2,c2) = (alpha*f1+(1-alpha)*f2,
------------------------------------------------

mouse _ st (MouseButton WheelUp) Down _ _ = do
st $~ (+1)
updateW st (+1)
mouse _ st (MouseButton WheelDown) Down _ _ = do
st $~ (subtract 1)
updateW st (subtract 1)
mouse def _ a b c d = def a b c d

maybeToList Nothing = []
maybeToList (Just a) = [a]

toSave _ st (Char 's') Down _ _ = do
cams <- get st
cams <- getW st
writeFile "cameras.txt" (show cams)
toSave def _ a b c d = def a b c d

Expand Down
14 changes: 7 additions & 7 deletions compvis/pose/multiposenew-0.hs
@@ -1,7 +1,7 @@
-- experiments on multiview calibration from stabilized pose
-- ./multipose swebcam0 swebcam1 webcam2 '--focals=[1.7,1.7,2.7]' +RTS -N2 -RTS --alpha=0.95

import EasyVision hiding ((.*),State)
import EasyVision hiding ((.*))
import qualified EasyVision as EV
import Graphics.UI.GLUT hiding (Matrix, Size, Point, triangulate,scale)
import Vision
Expand Down Expand Up @@ -222,24 +222,24 @@ weighted alpha (f1,r1,c1) (f2,r2,c2) = (alpha*f1+(1-alpha)*f2,
------------------------------------------------

mouse _ st (MouseButton WheelUp) Down _ _ = do
st $~ (+1)
updateW st (+1)
mouse _ st (MouseButton WheelDown) Down _ _ = do
st $~ (subtract 1)
updateW st (subtract 1)
mouse def _ a b c d = def a b c d

toSave _ st (Char 's') Down _ _ = do
cams <- get st
cams <- getW st
writeFile "cameras.txt" (show cams)
toSave def _ a b c d = def a b c d

toLock _ st (MouseButton LeftButton) Down _ _ = do
st $~ not
updateW st not
toLock def _ a b c d = def a b c d

chView _ st (MouseButton WheelDown) Down _ _ = do
st $~ subtract 1
updateW st $ subtract 1
chView _ st (MouseButton WheelUp) Down _ _ = do
st $~ (+1)
updateW st (+1)
chView def _ a b c d = def a b c d

-------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions compvis/pose/multiposenew-1.hs
@@ -1,7 +1,7 @@
-- experiments on multiview calibration from stabilized pose
-- ./multipose swebcam0 swebcam1 webcam2 '--focals=[1.7,1.7,2.7]' +RTS -N2 -RTS --alpha=0.95

import EasyVision hiding ((.*),State)
import EasyVision hiding ((.*))
import qualified EasyVision as EV
import Graphics.UI.GLUT hiding (Matrix, Size, Point, triangulate,scale)
import Vision
Expand Down Expand Up @@ -238,24 +238,24 @@ weighted alpha (f1,r1,c1) (f2,r2,c2) = (alpha*f1+(1-alpha)*f2,
------------------------------------------------

mouse _ st (MouseButton WheelUp) Down _ _ = do
st $~ (+1)
updateW st (+1)
mouse _ st (MouseButton WheelDown) Down _ _ = do
st $~ (subtract 1)
updateW st (subtract 1)
mouse def _ a b c d = def a b c d

toSave _ st (Char 's') Down _ _ = do
cams <- get st
cams <- getW st
writeFile "cameras.txt" (show cams)
toSave def _ a b c d = def a b c d

toLock _ st (MouseButton LeftButton) Down _ _ = do
st $~ not
updateW st not
toLock def _ a b c d = def a b c d

chView _ st (MouseButton WheelDown) Down _ _ = do
st $~ subtract 1
updateW st $ subtract 1
chView _ st (MouseButton WheelUp) Down _ _ = do
st $~ (+1)
updateW st (+1)
chView def _ a b c d = def a b c d

-------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions compvis/pose/multiposenew.hs
@@ -1,7 +1,7 @@
-- experiments on multiview calibration from stabilized pose
-- ./multipose swebcam0 swebcam1 webcam2 '--focals=[1.7,1.7,2.7]' +RTS -N2 -RTS --alpha=0.95

import EasyVision hiding ((.*),State)
import EasyVision hiding ((.*))
import qualified EasyVision as EV
import Graphics.UI.GLUT hiding (Matrix, Size, Point, triangulate)
import Vision
Expand Down Expand Up @@ -227,24 +227,24 @@ weighted alpha (f1,r1,c1) (f2,r2,c2) = (alpha*f1+(1-alpha)*f2,
------------------------------------------------

mouse _ st (MouseButton WheelUp) Down _ _ = do
st $~ (+1)
updateW st (+1)
mouse _ st (MouseButton WheelDown) Down _ _ = do
st $~ (subtract 1)
updateW st (subtract 1)
mouse def _ a b c d = def a b c d

toSave _ st (Char 's') Down _ _ = do
cams <- get st
cams <- getW st
writeFile "cameras.txt" (show cams)
toSave def _ a b c d = def a b c d

toLock _ st (MouseButton LeftButton) Down _ _ = do
st $~ not
updateW st not
toLock def _ a b c d = def a b c d

chView _ st (MouseButton WheelDown) Down _ _ = do
st $~ subtract 1
updateW st $ subtract 1
chView _ st (MouseButton WheelUp) Down _ _ = do
st $~ (+1)
updateW st (+1)
chView def _ a b c d = def a b c d

-------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions compvis/pose/newdynamic.hs
Expand Up @@ -4,6 +4,7 @@
module Main where

import EasyVision as EV
import EasyVision.GUI.OldGUI
import System.Environment(getArgs)
import qualified Data.Map as Map
import Graphics.UI.GLUT hiding (Matrix, Size, Point)
Expand Down
8 changes: 4 additions & 4 deletions compvis/pose/rightAngles.hs
Expand Up @@ -2,7 +2,7 @@

import EasyVision
import Graphics.UI.GLUT hiding (Size, Point)
import System(getArgs)
import System.Environment(getArgs)
import Control.Monad(when)
import Numeric.LinearAlgebra
import Util.Misc(splitEvery)
Expand Down Expand Up @@ -38,15 +38,15 @@ rightAngles img = do
pointSize $= 3
renderPrimitive Points $ mapM_ vertex ps
mouse wrect _ st (MouseButton LeftButton) Down _ (Position x y) = do
st $~ (Pixel (fromIntegral y) (fromIntegral x) :)
ps <- get st
updateW st (Pixel (fromIntegral y) (fromIntegral x) :)
ps <- getW st
let pts = pixelsToPoints (size img) $ ps
rec = rectifier pts
putW wrect (htp rec pts, rec)
postRedisplay Nothing
postRedisplay (Just $ evW wrect)
mouse _ _ st (Char 'x') Down _ _ = do
st $~ (\l -> if null l then l else tail l)
updateW st (\l -> if null l then l else tail l)
postRedisplay Nothing
mouse _ def _ a b c d = def a b c d

Expand Down
2 changes: 1 addition & 1 deletion compvis/pose/whiteboard.hs
Expand Up @@ -59,6 +59,6 @@ worker cam wImage wA4 ratio szA4 = do
---------------------------------------------------------

mouse _ st (MouseButton LeftButton) Down _ _ = do
st $= ident 3
putW st $ ident 3

mouse def _ a b c d = def a b c d
4 changes: 2 additions & 2 deletions compvis/simple/background.hs
Expand Up @@ -22,8 +22,8 @@ main = do


mouse _ st (Char 's') Down _ _ = do
(_,b) <- get st
st $= (True,b)
(_,b) <- getW st
putW st (True,b)

mouse def _ a b c d = def a b c d

Expand Down
1 change: 0 additions & 1 deletion compvis/simple/detect.hs
Expand Up @@ -2,7 +2,6 @@

import EasyVision
import Graphics.UI.GLUT hiding (Size)
import System
import Util.Options

main = do
Expand Down

0 comments on commit 6b6cf76

Please sign in to comment.