Www.ngi-central.org
This presentation is the property of its rightful owner.
Sponsored Links
1 / 32

Traditional Image Processing PowerPoint PPT Presentation


  • 51 Views
  • Uploaded on
  • Presentation posted in: General

Traditional Image Processing. Data Structures Images, Palettes , Histograms , Profiles , etc. For many datatypes (8bit, 16 bit , float , etc.) Algorithms Dependent on Data Structures Dependent on datatypes Combinatorial Explosion -> unmanageable

Download Presentation

Traditional Image Processing

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Traditional image processing

www.ngi-central.org


Traditional image processing

Traditional Image Processing

  • Data Structures

    • Images, Palettes, Histograms, Profiles, etc.

    • Formanydatatypes (8bit, 16 bit, float, etc.)

  • Algorithms

    • Dependent on Data Structures

    • Dependent on datatypes

  • Combinatorial Explosion -> unmanageable

    • Toimplementonenewalgorithm, it must bewrittenmanytimes – foreach type

www.ngi-central.org


Traditional image processing

Generic Image Processing

  • GenericProgrammingcomestotherescue

  • Threekey design techniques

    • Iteratorsdecoupledatastructures and algorithms

    • Functorsallowtoexchangepartsofcomputation

    • Genericalgorithms in termsofabstractiterators and functors

  • Enablingtechnologyofcompilersisthetemplate<> mechanism

www.ngi-central.org


Traditional image processing

Standard Template Library

  • STL is an implementationofgenericprogrammingconcepts

  • STL isavailablewith all compilerssinceitispartofthe C++ standard

  • STL isaround 10 yearsold and consideredmature

  • Educational material tolearngenericprogramming in generaland STL in particularisavailable

www.ngi-central.org


Traditional image processing

Example: RGB to Gray

  • Using STL style programming

    structRGBValue {

    unsignedcharred, green, blue;

    };

    structRGBToGray {

    unsignedcharoperator()(constRGBValue& rgb) const {

    return 0.3*rgb.red + 0.59*rgb.green + 0.11*rgb.blue;

    }

    };

    vector<RGBValue> rgb;

    vector<unsignedchar> gray;

    ...

    transform(rgb.begin(), rgb.end(), gray.begin(), RGBToGray());

www.ngi-central.org


Traditional image processing

New:worksfor all types!

Betterexample

  • Templated on thedatatype

  • <template class T>

  • struct RGBValue {

  • T red, green, blue;

  • };

  • <template class T>

  • struct RGBToGray {

  • T operator()(const RGBValue<T>& rgb) const {

  • return 0.3*rgb.red + 0.59*rgb.green + 0.11*rgb.blue;

  • }

  • };

  • vector<RGBValue<float> > rgb;

  • vector<float> gray;

  • ...

  • transform(rgb.begin(), rgb.end(), gray.begin(), RGBToGray<float>());

www.ngi-central.org


Traditional image processing

STL leavesthingstodesire

  • STL isdesignedtoworkwith 1D data

  • Images areinherentlytwo(multi)dimensional

  • Somealgorithms do not needthedimensionality

    • Use STL in thiscase

  • Somealgorithmsneedthedimensionality

    • Cannotuse STL, needsomething different

www.ngi-central.org


Traditional image processing

Multidimensional Locators

  • A locatoris a multidimensional iterator

  • Logical extensionto an iterator

Move theiterator

++it;

--it;

it+=100;

it-=50;

Move thelocator

++it.x;

--it.y;

it.x+=100;

it.y-=50;

www.ngi-central.org


Traditional image processing

Algorithms change as well

  • // STL implementation

  • template<class IT, class F>

  • IT transform(IT First, IT Last, IT Dest, F Func)

  • {

  • for (; First != Last; ++First, ++Dest)

  • *Dest = Func(*First);

  • return (Dest);

  • }

  • // 2D implementation

  • template<class IT, class F>

  • IT transform(IT First, IT Last, IT Dest, F Func)

  • {

  • for (; First.y != Last.y; ++First.y, ++Dest.y)

  • for (; First.x != Last.x; ++First.x, ++Dest.x)

    • *Dest = Func(*First);

  • return (Dest);

  • }

www.ngi-central.org


Traditional image processing

What do wegain?

  • An algorithmliketransformreplacesmanyfunctions in traditional programming style

  • Itcan do this, becauseitistemplated on thefunction

    • We still needtoprogramthefunctionality, but decoupledfromnavigation

    • Itsavesustorewritetheloopsmanytimes

    • Bonus: thefunctionobjectscanbereused in completely different algorithmsas well

  • Itcan do this, becauseitistemplated on thedatatype (byiteratorindirection)

    • Itsavesustorewritethecompletethingforeachdatatype

  • The gainistremendous (time, functionality, flexibility)

www.ngi-central.org


Ngi goals

NGI - Goals

  • Image Processing

    • Image -> Image

  • Image Analysis

    • Image -> Numbers

  • Generic Library

    • C++

    • Templates

    • Source code

    • Independence of type

  • High Performance

    • nopenaltyforgenericcode

  • Portability

    • clean sourcecodefor easy portability

www.ngi-central.org


Traditional image processing

Directory Structure

  • Code (include/)

  • Third partycode (toolkits/)

  • Documentation (book/, reference/, presentations/)

  • Sample code (samples/) and sample images (images/)

  • Automated tests (tests/)

www.ngi-central.org


Ngi tests

NGI - Tests

  • Unit Tests

    • Features of a class/functionaretested in isolation

  • Regression Tests

    • Outcomeof a functionistestedforregressions

    • Image/Text comparisons (now == previous)

  • Benchmarks

    • Measured in clocks per pixel

www.ngi-central.org


Ngi documentation

NGI - Documentation

  • User Documentation

    • NGI Book

  • Reference Documentation

    • BuiltwithDoxygenfromsourcecode (HTML)

    • Alwaysup-to-date

www.ngi-central.org


Traditional image processing

Third Party Code

  • Mandatory

    • boost (www.boost.org)

  • Optional

    • FreeImage (freeimage.sourceforge.net)

    • Cairo (www.cairographics.org)

www.ngi-central.org


Ngi build system

NGI – Build System

  • CMakeisusedasbuildengine

  • modular

    • selectcompiler(VS2005, VS2008, VS2010, Intel)

    • runtests

    • builddocumentation

  • Currentlysettingup a continuousbuildmachinewithvariousvirtualbuildenvironments

www.ngi-central.org


Traditional image processing

Sample Code

  • Manycodesamples

    • Consolesamples

    • MFC samples

    • .NET samples

  • Tests are also samples

    • UsingBoost.Test

    • Unit tests, benchmarks, regressiontests

www.ngi-central.org


Ngi guidelines

NGI – Guidelines

  • Header onlylibrary

  • Source code

  • Heavy useoftemplates

  • Concentration on coreissues

  • usingother Open Source librarieswhereapplicable

    • Boost, FreeImage, Cairo, Qt

www.ngi-central.org


Ngi concepts

NGI – Concepts

  • Buffer

    • storesdata

    • handlesallocation and deallocation

    • canuseexternalbuffers

  • View

    • levelofindirection

    • light, just a pointer and a fewpitches

    • all accessesthroughviews

    • can handle foreigndatabuffers

    • viewmanipulations

      • sub-views (moving_view.exe)

      • rotatedviews (dimension_swap_view.exe)

      • reversescanningdirections (reverse_view.exe)

      • subsampling (subsampling_view.exe)

www.ngi-central.org


Ngi functionality overview 1

NGI – FunctionalityOverview (1)

  • Basic functionsusedeverywhereelse

    • Interpolation

      • linear, spline

    • Geometry

      • point, line_segment, ray, line, triangle, quadrilateral, rectangle, polygon, circle, ellipse

      • widgetsfor all geometricelements

    • Other examples

      • Base64, ZIP/GZIP Compression/Decompression, Fixed point, Matrix solver, solvingquadratic and cubicequations, etc.

www.ngi-central.org


Ngi functionality overview 2

NGI – FunctionalityOverview (2)

  • STL likefunctions

    • copy, count, equal, find, ...

  • Image Processing functions

    • Point, Filters, Morphology, ...

  • Image Analysis functions

    • Blob, Pattern match, OCR/OCV, ...

  • Display Engine

    • Images, Palettes, Curves, Widgets, Geometry, ...

  • Framegrabber/Camerainterface

www.ngi-central.org


Ngi stl like functions

NGI – STL LikeFunctions

  • accumulate

  • copy

  • count

  • equal

  • fill

  • find

  • generate

  • inner_product

  • max_element

  • min_element

  • replace

  • transform

www.ngi-central.org


Ngi image processing functions 1

NGI – Image Processing Functions (1)

  • Point functions (point_operations.exe, profile.exe)

  • Filter and morphologicalfunctions (neighborhood_operations.exe)

    • 1D, 2D, 3D

    • Separable

    • Fast box filters – independentofkernelsize

    • Manypredefinedkernels, usercaneasilyadd

    • Framing (framing.exe)

    • Erode, Dilate, Open, Close, Gradient

    • Gray and binarybehavior

www.ngi-central.org


Ngi image processing functions 2

NGI – Image Processing Functions (2)

  • Binning (binning.exe)

    • binningmethodselectable/userwritable

  • Geometric Transformation (resample.exe)

    • affine / polar

    • choiceofresampling filter (nearestneighbor, box, triangle, quadratic, cubic, bspline, sinc, kaiser, lanczos)

  • Autofocus

    • based on variance, gradient

www.ngi-central.org


Ngi image processing functions 3

NGI – Image Processing Functions (3)

  • Color Processing

    • Color models (color_transform.exe)

      • RGB, CMY(K), HLS, HSI, Lab, Lchab, Luv, Lchuv

    • Color twist (color_twist.exe)

    • Bayer demosaic

  • StatisticFunctions

    • min, max, average, variance, percentiles

  • CameraCalibration

www.ngi-central.org


Ngi image analysis functions 1

NGI – Image Analysis Functions (1)

  • Blob analysis

    • Thresholding via Otsu‘smethod

    • 2D, 3D Labelling

    • Fläche/Volumen

    • Chain Code (inner, outer), perimeter

    • Moments

      • binary, gray

      • ordinary, central, Hu, Flusser

www.ngi-central.org


Ngi image analysis functions 2

NGI – Image Analysis Functions (2)

  • Pattern matching and searching (search.exe)

    • grayorcolor

    • usingpyramidforacceleration

  • OCR/OCV

    • train a characterset

    • read/verifytext

www.ngi-central.org


Ngi acceleration

NGI - Acceleration

  • Writtenfor Multi-Core

    • UsesOpenMP

    • Most functionsscalenicely, canbeseenwiththebenchmarks

  • Working on SIMD acceleration

    • Vector Processing (128 bytechunks)

    • 16 Pixels at a time

    • First forpointfunctions

  • These twomethodsare orthogonal

www.ngi-central.org


Ngi display engine 1

NGI – Display Engine (1)

  • Display Engine

    • Direct2D, GDI Plus, OpenGL, Cairo

    • Alpha channel support (blit.exe)

    • Images (file_access.exe)

    • Palettes (palette.exe, false_color.exe)

    • Curves (histogram.exe)

www.ngi-central.org


Ngi display engine 2

NGI – Display Engine (2)

  • Widgets (scale.exe)

  • Hierarchicalwidgetcomposition(widget_box.exe)

  • Callbacksfor smart interaction(horizontal_cursor.exe)

www.ngi-central.org


Ngi framegrabber camera

NGI – Framegrabber/Camera

  • Grabbingintoringbuffer

  • asynchronous on different thread

  • live/snapshot

  • pre-trigger/post-trigger

  • Gen<i>cam support planned

www.ngi-central.org


More information

More Information

www.ngi-central.org

ngi-central.blogspot.com

[email protected]

www.ngi-central.org


  • Login