opencv-0.0.2.1: Haskell binding to OpenCV-3.x

Safe HaskellNone
LanguageHaskell2010

OpenCV.HighGui

Contents

Description

While OpenCV was designed for use in full-scale applications and can be used within functionally rich UI frameworks (such as Qt*, WinForms*, or Cocoa*) or without any UI at all, sometimes there it is required to try functionality quickly and visualize the results. This is what the OpenCV.HighGui module has been designed for.

It provides easy interface to:

  • Create and manipulate windows that can display images and “remember” their content (no need to handle repaint events from OS).
  • Add trackbars to the windows, handle simple mouse events as well as keyboard commands.

Synopsis

Window management

makeWindow :: String -> IO Window Source #

Create a window with the specified title.

Make sure to free the window when you're done with it using destroyWindow or better yet: use withWindow.

destroyWindow :: Window -> IO () Source #

Close the window and free up all resources associated with the window.

withWindow :: String -> (Window -> IO a) -> IO a Source #

withWindow title act makes a window with the specified title and passes the resulting Window to the computation act. The window will be destroyed on exit from withWindow whether by normal termination or by raising an exception. Make sure not to use the Window outside the act computation!

resizeWindow :: Window -> Int32 -> Int32 -> IO () Source #

Resize a window to the specified size.

Event handling

Keyboard

Mouse

data EventFlags Source #

Context for a mouse Event

Information about which buttons and modifier keys where pressed during the event.

type MouseCallback Source #

Arguments

 = Event

What happened to cause the callback to be fired.

-> Int32

The x-coordinate of the mouse event.

-> Int32

The y-coordinate of the mouse event.

-> EventFlags

Context for the event, such as buttons and modifier keys pressed during the event.

-> IO () 

Callback function for mouse events

Trackbars

type TrackbarCallback Source #

Arguments

 = Int32

Current position of the specified trackbar.

-> IO () 

Callback function for trackbars

createTrackbar Source #

Arguments

:: Window 
-> String

Trackbar name

-> Int32

Initial value

-> Int32

Maximum value

-> TrackbarCallback 
-> IO () 

Drawing

imshow Source #

Arguments

:: Window 
-> Mat (S [height, width]) channels depth 
-> IO () 

imshowM Source #

Arguments

:: Window 
-> Mut (Mat (S [height, width]) channels depth) (PrimState IO) 
-> IO ()