module CV.HighGUI where
import Foreign.C.Types
import Foreign.C.String
import Foreign.ForeignPtr
import Foreign.Ptr
import CV.Image
import CV.Image
import CV.ImageOp
display image = do
makeWindow "__TMP__"
showImage "__TMP__" image
waitKey 0
destroyWindow "__TMP__"
mkWin :: String -> Int -> IO ()
mkWin a1 a2 =
withCString a1 $ \a1' ->
let {a2' = fromIntegral a2} in
mkWin'_ a1' a2' >>= \res ->
return ()
makeWindow name = mkWin name 1
destroyWindow n = withCString n $ \name -> do
cvDestroyWindow name
foreign import ccall "wrapper"
trackbarCallback :: (CInt -> IO ()) -> IO (FunPtr (CInt -> IO ()))
mkTrackbar mx initial name window callback = do
cb <- trackbarCallback callback
withCString name $ \cname ->
withCString window $ \cwindow ->
cvCreateTrackbar cname cwindow nullPtr (fromIntegral mx) cb
waitKey delay = cvWaitKey delay
showImage :: String -> Image c d -> IO ()
showImage a1 a2 =
withCString a1 $ \a1' ->
withGenImage a2 $ \a2' ->
showImage'_ a1' a2' >>= \res ->
return ()
foreign import ccall safe "CV/HighGUI.chs.h cvNamedWindow"
mkWin'_ :: ((Ptr CChar) -> (CInt -> (IO CInt)))
foreign import ccall safe "CV/HighGUI.chs.h cvDestroyWindow"
cvDestroyWindow :: ((Ptr CChar) -> (IO ()))
foreign import ccall safe "CV/HighGUI.chs.h cvCreateTrackbar"
cvCreateTrackbar :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CInt) -> (CInt -> ((FunPtr (CInt -> (IO ()))) -> (IO CInt))))))
foreign import ccall safe "CV/HighGUI.chs.h cvWaitKey"
cvWaitKey :: (CInt -> (IO CInt))
foreign import ccall safe "CV/HighGUI.chs.h cvShowImage"
showImage'_ :: ((Ptr CChar) -> ((Ptr ()) -> (IO ())))