Daisy : The Video Capture Library of the LV-SDS
Daisy is a Software Development Kit for programmers who want to integrate
PCI Frame Grabbers into their own applications. 
Features
- C++ Class library (16bit DLL) for Windows 3.x and Windows 95
- C++ Class library (32bit DLL) for Windows NT4.0
- Supports Borland C++ 5.x for both Daisy 16bit and 32bit
- Supports Microsoft Visual C++ 1.5x for Daisy 16bit
- Supports Microsoft Visual C++ 4.x for Daisy 32bit
- Realtime video capture supported
- Twain driver included
- Camera Editor to define non standard cameras
- Plug and Play connector handling
- Reference Manual as Windows Help file and printable Word file
- Automatic firmware update included in library 
General Description
Camera configuration
Predefined setting of camera configurations for the most popular cameras are available.
A camera definition is composed out of other predefined settings which are
VIDEO TYPE, COLOR CODING, ASPECT RATIO, VIDEO TIMING, SIGNAL COUPLING and 
SYNCHRONISATION. Each of these items is composed by specific settings, which can be 
adapted by the programmer. Like this, a user can compose his own camera setting for 
special cameras.
 
Leutron Vision offers a Camera Editor which assists you in defining your own cameras.
The Camera Editor produces a datafile with the detailed camera description. 
Daisy itself will read during startup this camera description and set the 
hardware according to the definitions.
¡@
Camera connection and activation
Depending on the camera cable and the actual Hardware, several cameras can be 
connected to the Framegrabber at the same time. There are functions available 
to control the proper use of the available physical connectors and for activating
one of the connected cameras. 
Video input parameters

Depending on the COLOR CODING, the following items can be set: 
 
 - Brightness  
 - Contrast  
 - Hue  
 - Saturation  
 - InputLut 
 
For all cameras the following items can be set: 
- Mirror  
- Scaling or Clipping 

Region of Interest configuration (ROI)
The coordinates of the live video image and its pixeldepths on screen can be defined
trough the ROI class. The ROI handling covers the whole video memory area,
therefore an image may be acquired in the off screen area too. 
The Windows API covers only the on screen area of the video memory, 
the ROI class offers a possibilty for the user to access images outside
the memory controlled by Windows.
¡@
Utility functions

- Automatic palette handling for greyscale images (display set 256 colors)  
- Synchronisation to camera or monitor timing  
- Optocoupler control  
- Version control of the library  
- Automatic firmware update 
Class Overview
LvCPUWindow Information about video memory
LvCameraInfo Information data for cameras
LvCameraNode Represents any input equipment
LvCameraSignal Camera signal definition
LvCameraTiming Timing data for cameras
LvConnectionInfo Information about connectors
LvConnector Represent a connector for an external device
LvGrabberNode Represents a video grabber installed in the system.
LvLockMask Lock mask info
LvMemInfo Information about video memory
LvMonitorNode Represents any output equipment
LvROI Represents the Region Of Interest
LvROIInfo Information structure for ROI
LvSourceInfo Camera Region of interest
LvCameraNodeObjects belonging to the LvCameraNode class represent the input
equipment used to transfer in the video memory images from the outer world. 
  
Activate Activates the camera
Freeze Puts the camera in 'freeze' mode
GetBrightness Retrieves the actual Brightness level
GetContrast Retrieves the actual contrast level
GetHandle Gets the handle associated with the camera object
GetHue Retrieves the actual Hue level
GetSaturation Retrieves the actual Saturation level
GetSourceROI Retrieves the actual area of interest
GetVideoTimingType Retrieves the Camera timing type
GetVideoType Retrieves the Camera type
IsConnected Checks if the camera is connected
IsLive Determines if the camera is in live mode
Live Puts the camera in 'live' mode
LoadLUT Load the input Look Up Table
SetBrightness Sets the Brightness level
SetContrast Sets the contrast level
SetHue Sets the Hue level
SetMirrorType Set the mirroring type for the incoming image
SetSaturation Sets the Saturation level
SetSourceROI Retrieves the actual area of interest
WaitSync Waits a synchronization signal on the selected input
¡@
LvConnectorEach Camera can be connected to the grabber through an Input Connector;
depending on the type of connector used, it will be possible to connect to the
grabber a different number of camera types. 
¡@
Each available connector is represented by a Handle, that uniquely identifies
the connector in the system; the user application, when connecting input devices
should specify where the equipment will be physically connected in order to allow
Daisy to perform the correct settings. 
  
FreeConnector Frees the specified connector
GetConnectorInfo Returns informtion about the connector associated with the specified HCONNECTION
GetFreeInfo Returns information about the actually free connectors
GetNrFree  Returns the number of free connector for a given video type
LvGrabberNodeObjects belonging to the LvGrabberNode class represent a video
grabber installed in the system. 
More than one grabber can be installed in the system, Daisy will provide
different LvGrabberNode objects and each of them will act only on the physical
board it represents.
¡@
Handles and connections

External equipment, like monitors and cameras, can be connected to a grabber;
in its base concept a grabber supports more than one input and more than one
output connections; so, in order to ask Daisy to operate on the correct
equipment an application has to use Handles. 
All the handles representing external equipment are of type HCONNECTION;
for easier code readibility are also defined the HCAMERA and HMONITOR typedefs.
Through a handle the application can still have a reference to the object it
represents, so it can directly use its interface.
¡@
Monitors
More than one monitor could be connected to the hardware, of course if the hardware
itself can support them; the actual implementation of the hardware can support
only one monitor connection, so these methods are kept for future use;
to maintain future compatibility also the user application are recommended to
use the query methods instead of assuming a one-monitor system.
¡@
Actually Daisy takes care of connecting the monitor and of activating it during
its initialization, so the application has not to deal with this system setting. 
¡@
Input Connectors
In order to allow the end user to choose the input where the Camera will be
connected to, Daisy offers query methods to retrieve data about the connectors
still free in the system; these information can be then presented to the end user
that will choose the desired input; the connector descriptor maintains also a
ASCII string that will match the description on the physical cable
(i.e RGB1, YC_C1 and so on). 
¡@
Cameras
The LvGrabberNode allows the user application to connect a Camera to the grabber,
activate or deactivate it. Each camera is represented in Daisy by a Handle that
uniquely identifies it in the system; the user can use this handle to refer to
a specific input equipment when accessing other grabber methods. Knowing its handle,
a user application can retrieve a pointer to each LvCameraNode object. 
  
ActivateCamera Activates a previously connected camera.
ActivateMonitor Activates a previously connected monitor.
ActivateROI Moves the region of interest.
ConnectCamera Connects an input equipment to the grabber.
ConnectMonitor Connects an output equipment to the grabber.
DeactivateCamera Deactivates a previously connected and actiivated camera.
DisableVMemAccess Restores the grabber status after a direct video memory access.
DisconnectCamera Disconnects a previously connected camera.
EnableVMemAccess Prepares the grabber memory to be directly accessed by user application.
GetCameraPtr Gets a pointer to the specified camera object.
GetConnectedCamera Retrieves the handles of the input equipments currently connected.
GetConnectedMonitor Retrieves the handles of the output equipments currently connected.
GetConnectionInfo Retrieves information about a connection (camera or monitor)
GetConnectorName Retrieves the name of the connector where a camera is connected
GetConnectorType Retrieves the connector type detected on the grabber.
GetDeviceInfo Retrieves information about the associated grabber
GetFreeConnectorInfo Retrieves information about free input connectors.
GetMonitorPtr Gets a pointer to the specified monitor object.
GetNrConnectedCamera Retrieves the number of input equipment currently connected.
GetNrConnectedMonitor Retrieves the number of the connected monitors.
GetNrFreeConnector Retrieves the number of free input connectors.
LoadOutGreyScale Loads the output grey palette.
LoadOutPalette Loads the specified output palette.
RecheckConnector Perform the connector recognition procedure after startup.
RetrieveROI Retrieves the content of the defined region of interest.
SaveOutPalette Saves the currently set output palette.
SetScaleMode Sets the scale mode used for a camera.
SetVGAMode Sets the specified VGA mode
StoreROI Retrieves the content of the defined region of interest.
UpdateLockMask Updates the lock mask for the specified camera
¡@
LvROIA Region Of Interest, also called ROI, is a rectangular part of video
memory formatted with a specific color coding, that can be different from the
actual output formatting, depending on the use the application wants to do of this
memory; for example,
an incoming image is placed in a ROI and also the output screen is a ROI.
The user application can retrieve from Daisy information about the ROI currently active,
those related with external equipment connected to the grabber, so that it can access
that part of memory interpreting in the right way the data stored in it.
A ROI is defined by its position in the Video memory, by its dimensions and by the
color coding used to generate it. A user application can generate and use its own ROI,
in order to store in the Video Memory application related data.

A ROI is defined in the system by the LvROIInfo structure; since exists a strict
relationship among the content of its fields, Daisy provides the LvROI class that can
be used by the application to manage the LvROIInfo data in order to be sure that the 
content of their fields is coherent. All the LvROIInfo attributes remain 'public', so
that the reading access to them can be a little bit faster, but the user application
is strongly recommended to use the methods provided by LvROI to set those attributes in
order to have them coherent.
GetArea Retrieves the actual dimension of a ROI
SetMemoryWidth Specifies the width of the physical memory
SetHResolution Specifies the width of the display memory
SetColorFormat Sets the color format which the roi represents
SetDimension Sets roi dimension
SetStartPosition Sets the start position of the roi in the memory
SetLockMask Set Lock mask properties for the ROI
SetROIInfo Sets the content of the ROI
DirectCapture, the Video Capture Library 
DirectCapture is a Software Development Kit for programmers who want to
integrate Leutron Vision PCI Frame Grabbers into their own applications. 
Features
- C library (32bit DLL) for Windows NT4.0 and Windows 95  
- implemented with Microsoft's Direct Draw  
- language independent  
- sample code for Microsoft Visual C, Visual Basic, Borland C and Delphi  
- Realtime video capture supported  
- Camera Editor to define non standard cameras  
- Plug and Play connector handling  
- Reference Manual as Windows Help file and printable Word file  
- Automatic firmware update included in library 

General Description
Introduction
DirectCapture is a language independent software library for the control of
Leutron Vision image processing boards. DirectCapture is a marriage of Leutron's
hardware related DAISY software library and Microsoft's Direct Draw with the goal
of simplifying the development of user applications.
DirectCapture uses a window paradigm to facilitate the control of the image processing
boards. The library allows the creation of On Screen Window and Off Screen Window
objects. The On Screen Window objects enable the display of live video on the desktop
from the image processing boards with scaling, clipping, mirroring, and overlaid text
and graphics. The Off Screen Window objects provide many of these features while 
directing the video stream directly to system memory instead of the windows desktop.
¡@
On Screen Windows
The On Screen Window object is provided for the display of live video on the 
Widows NT desktop. The On Screen Window objects is created by passing the 
handle (HWND) of a Windows NT window into the LvDcCreateOnScreenWin function.
DirectCapture takes the Windows NT window handle and subclasses it to take control
of the window. Subclassing is the technique where by all windows message generated
for a window will now be handled by the software which subclassed the window, in
effect taking over control of the window. The LvDcCreateOnScreenWin will pass back
a handle (HDCVIDEOWIN ) of the newly created On Screen Window object. This handle
must be used in all future to calls to the DirectCapture library to manipulate the
On Screen Window. 
¡@
Off Screen Windows

The Off Screen Window object is provided to direct live video to system memory.
The Off Screen Window Object is created by calling the LvDcCreateOffScreenWin function
which will pass back a handle to the newly created window (HDCVIDEOWIN). Like the On
Screen Windows all function calls which manipulate the Off Screen Window require the
handle returned from the create call.
¡@
DirectCapture Components

DirectCapture consists of two separate DLL's, the DSYCTL.DLL and the CAMDLG.DLL.
The DSYCTL.DLL contains all the functions for creating and using the On and Off 
Screen Window objects and the CAMDLG.DLL contains the routines to select grabbers
and cameras to connect to the window objects. The C source code for the CAMDLG.DLL
library is provided so that the users can customize the dialog as they wish. 
¡@
Camera configuration
Predefined setting of camera configurations for the most popular cameras are
available.Leutron Vision offers a Camera Editor which assists you in defining your
own cameras. The Camera Editor produces a datafile with the detailed camera description.
DirectCapture itself will read during startup this camera description and set the
hardware according to the definitions. 
Function Overview
The following is a list of features that are supported by the On and Off Screen 
windows and a description of each.
¡@
- Scaling
  
  Both the On and Off Screen Windows support scaling. When scaling is enabled the cameras
  field of view will be scaled to fit the size of the window on screen or in memory.
  For example, if the size of the window is set to 150 x 150 pixels and a video source
  with a field of view of 576 x 452 is being used the entire image will be scaled down
  to 150 x 150 for display or capture.
¡@

- Clipping
  
  Both the On and Off Screen Windows support clipping.With clipping only the portion of
  the video that will fit within the size of window will be displayed or captured 
  to memory. For example, if the size of the widow is set to 150 x 150 pixels and a 
  video source with a field of view of 576 x 452 is being used only a 150 x 150 pixel
  window will be displayed or captured.
¡@

- Mirroring
  
  Both the On and Off Screen Windows support mirroring along the vertical, horizontal
  or both axis.
¡@

- Overlay Text

  The On Screen Window supports overlaid text.Overlaid text allows the user to 
  overlay individual character strings on the live video. The font, size, color and
  position of the character string can be specified and changed through the
  DirectCapture library.
¡@

- User Masks
 
  Both the On and Off Screen Windows support user masks. A user mask is a one bit
  plane deep bit map that can be overlaid on the video. The mask can be created and
  manipulated via standard WIN32 function calls. Also the user can specify that the 
  mask should be stretched to match the size of the video.
¡@

- Copy to Clipboard

  Both window types support the copying of the video to the Window NT clipboard.
  For On Screen windows when the image is copied to the clipboard the current video card
  image format is used to determine the format of the image, i.e. when the desktop is at
  1280 x 1024 by 8 bits the image will be copied to the clipboard in 8bit color format.
  For off screen windows the format of the image copied to the clipboard can be set 
  using the LvDcSetColorFormat function. If there is a user mask set and enabled for 
  either window it will also be copied to the clipboard. Currently overlaid text is not
  copied to the clipboard.
¡@
  
- Get Image As Bitmap 
  
  Both windows support the retrieval of the video as a windows BMP. In the case of 
  the On Screen Windows the color format of the BMP will match the current Windows NT
  desktop setting. For Off Screen Windows the format of the image retrieved can be set
  using the LvDcSetColorFormat function. As with LvDcCopyToClipboard any user mask that
  has been enabled will be copied but overlaid text will not.  
¡@
- Adjusting Picture Controls 
  
  Both windows support the adjustment of brightness, contrast, hue and saturation.
¡@

- Events and Triggers
  On Screen Window objects can be configured to respond to Windows NT user interface
  actions and Off Screen Window objects can be configured to trigger on certain On
  Screen Widow actions.
 

On Screen Window objects can be configured to enter the live video mode when the
video window receives the desktop focus or only when it is the top most window.
Like wise it can be configured to freeze the video when it loses focus or is covered
by other windows. Also Off Screen Windows can be configured to go into live mode after
an On Screen Window freeze.  
¡@
¡@
- Window Association 

  Off Screen Window objects can be associated with On Screen Window objects. This allows
  a Off Screen Window to be configured to track the resize mode, color format, mirror 
  mode, live state, and freeze state of a selected On Screen Window . This will give the
  user the ability to have the video in system memory track the on screen video as 
  closely as possible.