55
Leutron Vision - OrChid Guide

Orchid Programming

  • Upload
    rayhsu

  • View
    746

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Orchid Programming

Leutron Vision - OrChid Guide

Page 2: Orchid Programming

Outline

✰Introduction✰Image Acquisition✰Image Processing✰Advanced Topics✰Commands

Page 3: Orchid Programming

Introduction

✰Orchid/Daisy✰DLL / .Net Class Library✰Log Message Receiver✰Obsolete - ActiveX

Page 4: Orchid Programming

IntroductionLog Message Receiver

Page 5: Orchid Programming

Introduction

✰Acquisition Modules

✰Processing Modules

Modules

Live Module (LvxLive)Real-Time Modules (LvxRt)

The Preprocessor Module (LvxPrep)The DirectX Preprocessor Module(LvxDX)

Page 6: Orchid Programming

Introduction

✰ Display Live Image✰ Making a Snap(By Stopping the Live)✰ Copying the Snap Image to Clipboard✰ Saving the Snap Image to a BMP, TIFF or JPG File✰ Saving Live Image to an AVI file✰ Returning the Snap Bitmap as Pointer to Device Independent

Bitmap✰ Display a Dialog Box for Grabber/Camera/Connector Selection✰ Display a Dialog Box for Live Image Setting✰ Possibility to Save/Load the Setting

LvxLive Module

Page 7: Orchid Programming

Introduction

✰ Primary Module / Asynchronous Reset Module✰ Grabbing of an Image or Sequence of Images to an Internal Buffer✰ Display the Acquired Sequence✰ Notify Frame Completion✰ Grabbing in a Loop to Simulate Live✰ Saving Image to BMP, TIFF, JPEG file✰ Adding Grabbed Image to AVI File✰ Copying Image to Clipboard✰ Display a Dialog Box

Real Time Module

Run-Time SettingI/O ConfigureCOM Ports Communication

Page 8: Orchid Programming

Introduction

✰Convert Pixel Format✰Applying Filters

Preprocessor Module

Noise ReductionBayer Array DecodingWhite Balance 、 Color Space CorrectionShading CorrectionOverlay Text or Graph

Page 9: Orchid Programming

Introduction

✰Image Manipulation✰Overlay Text and Graphics

DirectX Processor

Page 10: Orchid Programming

Introduction

✰C Interface✰Backward compatible

DLL Version of Orchid

Page 11: Orchid Programming

Introduction

✰Unmanaged/managed Code✰.NET Frame Work 2.0✰LeutronVision.Orchid.DLL

.Net Class Library

Page 12: Orchid Programming

Introduction

✰DLL - C✰.Net - C++✰lvx_OpenTask() / lvx_CloseTask()✰lvx_ Prefix✰Error Handling✰GDIPlus

Difference Between DLL and .Net Class Library Version

Page 13: Orchid Programming

Introduction

✰ The names of the Orchid .Net Classes correspond to the module types:• LvxLive - the Live module• LvxRt - the real-time Primary module (based on Basic Sequencer DRAL)• LvxRtAr - the real-time Asynchronous Reset module (based on Asynchronous Reset Sequencer DRAL)• LvxPrep - the Preprocessor module• LvxDX - the DirectX Processor module• LvxDll - auxiliary class for controlling the load of Orchid.DLL. Its properties and methods are static, i.e. you do not need to create an instance of this class and use the properties and methods directly.• LvxException - class for throwing exceptions, derived from System::Exception

Page 14: Orchid Programming

✰ • For C/C++ compilers the Orchid. l ib import library must be linked to your application and the Orchid.h file must be included. Note that for Borland compilers the OrchidBc.l ib must be used instead.

✰ • For Borland Delphi, the Orchid.pas unit is to be added to your project and referenced in the "uses" part in other units. Alternatively, you can use OrchidDyn.pas, which can load Orchid DLL on demand.

✰ • For MS Visual Basic 6 the Orchid.bas file is to be added to the project.

Linking Orchid With Your Application

Introduction

Page 15: Orchid Programming

Introdction

✰1. Check in your code2. Hardware Functionality3. Manual

✰Log Message Receiver

Trouble Shooting

* Running Before Orchid Application Star up* spends additional time by sending the messages to it

Page 16: Orchid Programming

Image Acquisition

✱ Setup A Connection✱ Specify Display Window✱ Showing the Live Image and Setting its Attributes

✱ Making a Snap and Setting its Attributes

✱ Recording to AVI File✱ Saving the Setting✱ Other Functions

Understanding LvxLive Module Functionality

Page 17: Orchid Programming

Image Acquisition

✰ LvxBaseAcquisition::Grabber, LvxBaseAcquisition::Connector, LvxBaseAcquisition::Camera

✰ lvx_DisplayConnectionDialog()

Setting Up a Connection

Page 18: Orchid Programming

Image Acquisition

✰Lvx_SetDisplayWindow()

Specify Display Window

Page 19: Orchid Programming

Image Acquisition

✰lvx_SetLive()✰lvx_SetGain()✰lvx_SetExposure()✰lvx_SetBlackLevel()

Showing the Live Image and Setting its Attributes

Page 20: Orchid Programming

Image Acquisition

✰lvx_DisplaySnapSettingDialog()✰lvx_CreateDisplayableImageBitmap()

Making a Snap and Setting its Attributes

Page 21: Orchid Programming

Image Acquisition

✰Select Compressor✰lvx_SaveAviSettings()✰lvx_LoadAviSettings()✰lvx_SetCaptureToAvi()

Recording to AVI File

Page 22: Orchid Programming

Image Acquisition

✰lvx_SaveSettings()✰lvx_LoadSettings()

Save Setting

Page 23: Orchid Programming

Image Acquisition

✰lvx_SetLoadWindowEnable()✰lvx_SetOptoOutput()

Other Functionality

Page 24: Orchid Programming

Image Acquisition

✰ Hardware: Direct to VGA Memory✰ Software: to CPU Memory✰ DirectX(Visible)✰ Hardware/Software Transition✰ MDI✰ Command: Window List Add / Window List Clear

Hardware Live V.S. Software Live

Page 25: Orchid Programming

Image Acquisition

✰Open Format✰Codec Issue✰lvx_DisplayAviSettingDialog()✰lvx_SaveAviSettings()

Create AVI File

Page 26: Orchid Programming

Image Acquisition

✰Frame Rate

✰Image Size

✰Can’t Resize

Creat AVI File

Indeo Version 4 - Quick Compress Option

LvxLive Module - Divided by 8

Page 27: Orchid Programming

Image Acquisition

✰lvx_OpenAviFile()✰lvx_CloseAviFile()✰lvx_SaveImageToAviFile()

AVI Functions

Page 28: Orchid Programming

Image Acquisition

✰ Sequences and Frames✰ Check Point✰ Module Type✰ More Initial Setting✰ Initializing the Module✰ Run-Time Settings✰ Grabbing✰ Specify Display Window✰ Live

Understanding the Functionality of Real-Time Modules

Page 29: Orchid Programming

Image Acquisition

✰ Accessing Grabbed Images✰ Storing Grabbed Images to File✰ Saving and Loading the Settings✰ I/O Settings✰ Other Functions✰ Advanced Functions

Understanding the Functionality of Real-Time Modules

Page 30: Orchid Programming

Image Acquisition

✰Circular Buffer✰Analog Grabber : Sub-Sequence✰Digital Grabber : Historical Reason

✰lvx_GetSubsequences()

Sequences and Frames

Page 31: Orchid Programming

Image Acquisition

✰Grabbing / Circular Buffer✰Check Control Value✰Continue Flag✰lvx_GrabContinue()✰Attribute: AsynchronousGrab

Check Points

Page 32: Orchid Programming

Image Acquisition

✰LvxRT✰LvxRtAr

Module Type

Page 33: Orchid Programming

Image Acquisition

✰lvx_Initialize()✰lvx_GrabContinue()

Initialize the Module

Page 34: Orchid Programming

Image Acquisition

✰LvRT

✰LvRtAr

Run Time Setting

LvxRT::ExternalTriggerLvxBaseAcquisition::SetGain()LvxBaseAcquisition::SetExposure()

LvxRtAr::ShutterTimeLvxRtAr::CameraRestartDelayLvxRtAr::FlashModeLvxRtAr::FlashEnable

Page 35: Orchid Programming

Image Acquisition

✰lvx_GrabContinue()✰wait for Triggerwait for Next Frame

✰lvx_SetNotifyCallBack()

Grabbing

Page 36: Orchid Programming

Image Acquisition

✰Handle✰lvx_SetTileImages()✰lvx_DisplayImage()/lvx_DisplayImageEX()

✰lvx_CreateDisplayableImageBitmap()

Specify Display Window

Page 37: Orchid Programming

Image Processing

✰Convert Color Format✰Preprocessing Filter✰Overlay Text

Page 38: Orchid Programming

Image Processing

✰Lvx_OpenTask(lvx_Task_Preprossor)

✰Attach to Acquisition Module✰lvx_SetOwnerTask()✰lvx_PreprocessImage()

Using the Preprocessor

Page 39: Orchid Programming

Image Processing

✰ Lvx_SetOwnerTask()✰ • Create the acquisition module and the preprocessor module.

✰ • Configure the acquisition module.✰ • lvx_Initialize() method.✰ 。 Lvx_SetOwnerTask()✰ 。 Configure Filters and Overlays

Sequences of initialize

Page 40: Orchid Programming

Image Processing

✰ The Color Format Conversion✰ Filters✰ Overlays✰ Text Shadow by the WriteTextToOverlay Method

Configuring the Preprocessor

Page 41: Orchid Programming

Image Processing

✰Color format Conversion

Configuring the Preprocessor

Lvx_SetImageBitsPerPixel()

Page 42: Orchid Programming

Image Processing

✰Filters

Configuring the Preprocessor

Bayer Array DecodingNoise ReductionWhite BalanceColor Space CorrectionShading Correction

Page 43: Orchid Programming

Image Processing

✰Filters

Configuring the Preprocessor

lvx_AddFilter()lvx_AddFilterRect()lvx_Command()

Page 44: Orchid Programming

Image Processing

✰Noise Reduction Filter

Configuring the Preprocessor

Pixel by Pixel

DestPixel=((100-Factor)*AcquiredPixel + Factor*AccumulatorPixel)/100

Page 45: Orchid Programming

Image Processing

✰White Balance

Configuring the Preprocessor

[R` G` B`] = [p1* R p2*G p3*B]

Page 46: Orchid Programming

Image Processing

✰Color Space Correction

Configuring the Preprocessor

Page 47: Orchid Programming

Image Processing

✰ ABSOLUTE_WHITE = (white_image_pixel - offset)* factor

✰ 0 = (black_image_pixel - offset)*factor✰ new_pixel_value = (acquired_image_pixel -

offset)* factor

Page 48: Orchid Programming

Image Processging

✰lvx_CreatOverlay()✰lvx_SetOverlayVisible()✰lvx_SetoverlayOffset()✰lvx_WipeOverlay()✰lvx_GetOverlayDc()✰lvx_ReleaseOverlayDc()

Overlays

Page 49: Orchid Programming

Image Processing

✰lvx_WriteTextToOverlay()✰lvx_PutBitmapToOverlay()

Overlays

Page 50: Orchid Programming

Image Processing

✰TextShadowOverlays

lvx_TextAttr_ShadowRBlvx_TextAttr_ShadowRTlvx_TextAttr_ShadowLBlvx_TextAttr_ShadowLTlvx_TextAttr_ShadowBlvx_TextAttr_ShadowTlvx_TextAttr_ShadowLlvx_TextAttr_ShadonR

Page 51: Orchid Programming

Image Processing

✰Preprocessing RunApplication Controlled PreprocessingAutomatic Preprocessing

Page 52: Orchid Programming

Image Processing

✰Application Controlled Preprocessing

Preprocessing Run

lvx_PreprocessImage()lvx_SetNotifyCallBack()lvx_OnCheckPoint()

Page 53: Orchid Programming

Image Processing

✰Automatic Preprocessing

Preprocessing Run

LvxRealTime::PreprocessingLimitation:• Only single preprocessor can be used.• It is applied when a checkpoint is reached, always only to the last image.• The preprocessing is done in-place, so the output color format must be the same as the input.

Page 54: Orchid Programming

Image Processing

✰Preprocessing in the LvxLive Module

Page 55: Orchid Programming

Image Processing

✰DirectX Display of Image

Reduce CPU LoadDirectDraw