Sapera Imaging Library

advertisement
Sapera LT
Agenda
•
•
•
•
•
Overview
Sapera++ Fundamentals
Sapera++ Class Descriptions
Sapera++ Examples
Advanced Topics
Overview
•
•
•
•
•
DALSA Coreco’s Main API
32 bit OOP, multi-threaded library
C++ encapsulation of low level ‘C’ library
Modular and device independent
Trigger-To-Image Reliability (T2IR)
Advanced Features (Version 6.00)
• Support for the Genie (GigE camera).
• Format conversion support in buffer module (in Sapera
and the CamExpert).
• RGB line profiler function in CamExpert.
• Diagnostic to for collecting all relevant DALSA Coreco
driver and SDK information.
• Tool for creating, editing and saving LUTs in CamExpert.
Compiler Support
• Microsoft Visual C++ 6 and Visual Studio .NET 2003
for the Standard C and Sapera++ APIs.
• Borland C++ Builder 6 or higher for the Standard C
and Sapera++ APIs.
• Microsoft Visual Basic 6 for the ActiveX controls.
• Borland Delphi 7 for the ActiveX controls.
• Microsoft Visual Studio .NET 2003 (C# and VB) for
the ActiveX controls.
Important Sapera Tools
CameraExpert
◦ The first step in creating an application.
◦ Supports flat-field correction and Bayer Conversion.
Sapera Configuration Tool
◦ Used for contiguous memory allocation and serial-port
assignment.
Application Wizard
◦ Speed the development cycle.
Sapera Diagnostic Tools
• LogViewer
◦ Logs and displays messages from all Sapera sources.
• PCI-Diagnostics
◦ Provides low-level information for devices on the bus.
• Direct Draw Capabilities
◦ Gives information on what modes support overlays
and the off-screen surface.
• Display Performance
◦ Benchmarks different operations in different display
modes.
Agenda
•

•
•
•
Overview
Sapera++ Fundamentals
Sapera++ Class Descriptions
Sapera++ Examples
Advanced Topics
Sapera Terminology
Server:
◦ Abstract representation of a physical device (e.g. PC,
frame grabber, etc…).
Resource:
◦ A set of functionality situated in hardware or software.
Module:
◦ Set of functions dedicated to a specific task (e.g. buffer
management).
The Sapera++ Architecture
Basic Classes:
◦ All classes related to getting the image from the
camera to the host computer
◦ Hardware Independent Classes
◦ Hardware Specific Classes
GUI Classes:
◦ MFC Specific
◦ User interfacing of common tasks
◦ Independent of the Basic Classes
Application Error Management
Errors can be reported in four ways:
◦ Messages are sent to a popup window
◦ Messages are sent to the LogViewer
◦ Messages are sent to the active debugger
◦ Messages are kept internally (the last can be retrieved
with ‘GetLastStatus()’)
During development the LogViewer can come in handy:
◦ Application and driver messages are stored by the
LogViewer
Capabilities and Parameters
Capabilities:
◦ Allow the interrogation of all functional aspects of a
given module
◦ Allows the application determine what features are
supported on a given piece of hardware
Parameters:
◦ Allow an application to configure all functional aspects
of a given module
◦ Allow an application to determine the current
configuration of a module
Steps to Building an Application
1.
2.
3.
4.
5.
Include SapClassBasic.h
Add $(SAPERADIR)\Classes\Basic to the include path.
Add SapClassBasic.lib to the Release build definitions.
Add SapClassBasicD.lib to the Debug build definitions.
Select ‘Multithreaded DLL’ as the run-time library used
during execution.
Agenda
•
•

•
•
Overview
Sapera++ Fundamentals
Sapera++ Class Descriptions
Sapera++ Examples
Advanced Topics
Sapera++ Class Descriptions
SapAcquisition:
◦ Implements access and configuration of acquisition
resources.
◦ Allows Signal Status verification (when an acquisition
device is has the capability; T2IR):
▪ Hsync/Vsync present, Hsync/Vsync locked, PixelClock present, Chroma present,
◦ Provides callbacks for key conditions and events:
▪ External Trigger, Trigger-Ignored, Vertical Sync
Present, Pixel-Clock Present/Missing, Frame-Lost,
Data-Overflow.
Sapera++ Class Descriptions
SapBuffer:
◦ Provides all buffer related functionality.
◦ Provides parameters for the control of acquisition and
the detection of error conditions (T2IR).
◦ Supports time/counter stamps (T2IR).
◦ Buffer copy method performs automatic data format
conversion between source and destination.
◦ Includes a new software BayerConversion and
WhiteBalance functions.
Sapera++ Class Descriptions
SapTransfer:
◦ Implements a flexible transfer process which supports
all Sapera compatible DALSA Coreco hardware.
◦ Specialized classes have been derived from
SapTransfer in order to simplify the most common
transfer configurations (e.g. SapAcqToBuf).
◦ Provides callbacks on transfer events such as
Start/End of frame, N-Lines/Line-N, as well as,
line/field data under-runs (T2IR).
Sapera++ Class Descriptions
SapView:
◦ Provides functionality for the display of data stored in a
SapBuffer objects.
◦ Uses an internal thread to manage data viewing.
◦ Takes care of access and control of available display
hardware (SapDisplay) including non-destructive
overlays (when image data is YUV).
◦ Provides control over zoom/scale of data in view.
◦ Is able to generate a user definable callback at the end
of the view window update.
Sapera++ Class Descriptions
SapDisplay:
◦ New methods have been added to provide information
of the display hardware’s state and capabilities.
◦ A function has been added that allows the application
to change the current display mode.
SapLut:
◦ Is a new Sapera++ class that implements Look-UpTable functionality for acquisition and viewing.
Sapera++ Class Descriptions
SapManager:
◦ Provides high level management capabilities to all
derived Sapera++ classes.
◦ Provides functions for the access, information and
control of Servers (I.e. Host PC, Frame Grabbers and
processing boards).
◦ Allows the selection of error reporting method, as well
as, error message/code retrieval.
SapLocation:
◦ Identifies a Server/Resource pair.
Sapera++ Class Description
SapGraphic:
◦ Implements functionality for the creation and display of
graphic objects and text.
◦ Provides control over draw modes (I.e. how graphics
and image data are combined).
◦ Allows for batch draw-mode when sending graphics to
the overlay surface.
◦ Provides a command for manual control of graphics
display.
Sapera++ Class Descriptions
SapGio:
◦ Provides control and information for a board’s general
I/O resources.
◦ Allows user defined callbacks to be issued when I/O
states change.
◦ Can be used with the SapCounter class to enable I/O
pin states to change automatically.
SapCounter:
◦ Allows for the counting of I/O events and timers.
◦ Is able to issue callbacks for counter events.
Sapera++ Class Descriptions
SapProcessing (not ‘the’ Sapera Processing!):
◦ The SapProcessing class must be derived in order to integrate
user defined processing.
◦ SapBuffer Full/Empty states are used to prevent current data from
being overwritten by new data.
◦ Processing can be user defined or, can include functionality
provided by Sapera Processing 5.30 (or later).
◦ A user defined callback can be defined to signal the end of
processing of the current image.
◦ Processing is performed inside a variable priority thread and
processing time can be read after each frame is processed.
Agenda
•
•
•

•
Overview
Sapera++ Fundamentals
Sapera++ Class Descriptions
Sapera++ Examples
Advanced Topics
Using Sapera++
Typical Allocation of Sapera++ objects:
// Allocate the buffer object
SapBuffer *pBuffer = new SapBuffer( 1, 512, 512);
if (pBuffer->Create())
{ // Buffer created OK... }
...
// Implicit BOOL operator for creation validation
if (*pBuffer)
{ pBuffer->Destroy(); }
// Release the object memory
delete pBuffer;
pBuffer = NULL;
Basic Image Display
SapBuffer *pBuffer;
SapView
*pView;
pBuffer = new SapBuffer(1, 640, 480, SapFormatMono8);
pView
= new SapView( pBuffer, SapHwndDesktop);
pBuffer->Create();
pView->Create();
pView->Show(); // Display the image on the desktop
pView->Destroy();
pBuffer->Destroy();
delete pView;
delete pBuffer;
Basic Acquisition and Display
// Object declaration
SapAcquisition *pAcq;
SapBuffer
*pBuffer;
SapTransfer
*pXfer;
SapView
*pView;
// Object allocation
pAcq
= SapAcquisition( SapLocation(“X64_1”, 0), myCamera.ccf);
pBuffer = new SapBuffer( 1, pAcq);
pView
= new SapView( pBuffer, SapHwndDesktop);
pXfer
= new SapTransfer( myXferCallback, pView);
pXfer->AddPair(SapXferPair( pAcq, pBuffer);
Basic Acquisition and Display
pAcq->Create();
// Create the objects
pBuffer->Create();
pXfer->Create();
pView->Create();
// Start a continuous transfer (live grab)
pXfer->Start();
...
pXfer->Stop();
// Stop the transfer
pXfer->Wait( 5000); // Wait for grab to stop
pXfer->Destroy();
pView->Destroy();
pBuffer->Destroy();
pAcq->Destroy();
delete
delete
delete
delete
pXfer;
pView;
pBuffer;
pAcq;
Basic Acquisition and Display
// Do the new image display in the transfer callback
void myXferCallback( SapXferCallbackInfo *pInfo)
{
// Display the last transferred frame
SapView *pView = (SapView *) pInfo->GetContext();
pView->Show();
}
Agenda
•
•
•
•

Overview
Sapera++ Fundamentals
Sapera++ Class Descriptions
Sapera++ Examples
Advanced Topics
Advanced Topics
Trash Buffers
◦ Trash buffers are a special type of buffers used for
receiving ‘lost’ images.
◦ A lost image occurs when the application has not
finished processing the image in the grab buffer.
◦ Grab synchronization is achieved using Empty/Full
flags in the buffer objects.
◦ Callback events can be attached to the Trash buffer in
order to know when an image is lost.
◦ Lost images must trigger recycling of the item being
inspected.
Trigger-To-Image Reliability
SapAcquisition Support:
◦ Signal Status can be checked:
▪ Horizontal/Vertical Sync present
▪ Horizontal/Vertical Sync Locked
▪ Pixel Clock present
▪ Chroma signal present
◦ Callbacks can be defined to signal:
▪ External Trigger Received/Ignored
▪ Horizontal/Vertical Sync lost
▪ Frame lost
▪ Data overflow
Trigger-To-Image Reliability
SapBuffer Support
◦ State Flags
▪ Buffer Full/Empty.
▪ Buffer Overflow.
◦ Counter Stamps
▪ Buffers can be stamped with an event count based on I/O
trigger counts.
◦ Buffers are always Time Stamped
▪ Using hardware timers if supported by the frame grabber.
▪ Using the high resolution system clock if not.
Trigger-To-Image Reliability
SapTransfer Support
◦ Callbacks can be defined to signal:
▪ Image Line Under-Runs: When less pixels than
expected are received in a given line.
▪ Image Field Under-Runs: When less lines than
expected are received in a given field (also applies
to single field images; I.e. progressive scan).
Sapera++
Question Period…
Download