Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes...
Transcript of Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes...
![Page 1: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/1.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Programming in C++using
RAVL
Bill Christmas
![Page 2: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/2.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Introduction
This presentation:
• includes a bit of the background to Ravl
• gives you an idea of some of the functionality available inRAVL;
• provides some examples of programming using RAVL;
..... not a comprehensive tour of RAVL
![Page 3: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/3.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Introduction
This presentation:
• includes a bit of the background to Ravl
• gives you an idea of some of the functionality available inRAVL;
• provides some examples of programming using RAVL;
..... not a comprehensive tour of RAVL
![Page 4: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/4.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Introduction
This presentation:
• includes a bit of the background to Ravl
• gives you an idea of some of the functionality available inRAVL;
• provides some examples of programming using RAVL;
..... not a comprehensive tour of RAVL
![Page 5: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/5.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Introduction
This presentation:
• includes a bit of the background to Ravl
• gives you an idea of some of the functionality available inRAVL;
• provides some examples of programming using RAVL;
..... not a comprehensive tour of RAVL
![Page 6: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/6.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
History
• AMMA C++ library — c. 1995?? — Radek Marik
• New version — RAVL — c. 2000 — Charles Galambos
![Page 7: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/7.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
History
• AMMA C++ library — c. 1995?? — Radek Marik
• New version — RAVL — c. 2000 — Charles Galambos
![Page 8: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/8.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL features
• C++ class library:• Basic containers• System interface• Maths, geometry inc. projective geometry - 2D & 3D• Image, video, 2D & 3D, audio and supporting tools• Pattern recognition• GUIs (GTK-based)• Applications (a few)
• Motivation:• lack of existing s/w (c. 1995)• C++ “difficult”• explicit memory management tedious
• Consistent programming interface
• Not much C++ knowledge required to use it
• RAVL and STL
• RAVL and OpenCV
![Page 9: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/9.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL features
• C++ class library:• Basic containers• System interface• Maths, geometry inc. projective geometry - 2D & 3D• Image, video, 2D & 3D, audio and supporting tools• Pattern recognition• GUIs (GTK-based)• Applications (a few)
• Motivation:• lack of existing s/w (c. 1995)• C++ “difficult”• explicit memory management tedious
• Consistent programming interface
• Not much C++ knowledge required to use it
• RAVL and STL
• RAVL and OpenCV
![Page 10: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/10.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL features
• C++ class library:• Basic containers• System interface• Maths, geometry inc. projective geometry - 2D & 3D• Image, video, 2D & 3D, audio and supporting tools• Pattern recognition• GUIs (GTK-based)• Applications (a few)
• Motivation:• lack of existing s/w (c. 1995)• C++ “difficult”• explicit memory management tedious
• Consistent programming interface
• Not much C++ knowledge required to use it
• RAVL and STL
• RAVL and OpenCV
![Page 11: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/11.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL features
• C++ class library:• Basic containers• System interface• Maths, geometry inc. projective geometry - 2D & 3D• Image, video, 2D & 3D, audio and supporting tools• Pattern recognition• GUIs (GTK-based)• Applications (a few)
• Motivation:• lack of existing s/w (c. 1995)• C++ “difficult”• explicit memory management tedious
• Consistent programming interface
• Not much C++ knowledge required to use it
• RAVL and STL
• RAVL and OpenCV
![Page 12: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/12.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL features
• C++ class library:• Basic containers• System interface• Maths, geometry inc. projective geometry - 2D & 3D• Image, video, 2D & 3D, audio and supporting tools• Pattern recognition• GUIs (GTK-based)• Applications (a few)
• Motivation:• lack of existing s/w (c. 1995)• C++ “difficult”• explicit memory management tedious
• Consistent programming interface
• Not much C++ knowledge required to use it
• RAVL and STL
• RAVL and OpenCV
![Page 13: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/13.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL features
• C++ class library:• Basic containers• System interface• Maths, geometry inc. projective geometry - 2D & 3D• Image, video, 2D & 3D, audio and supporting tools• Pattern recognition• GUIs (GTK-based)• Applications (a few)
• Motivation:• lack of existing s/w (c. 1995)• C++ “difficult”• explicit memory management tedious
• Consistent programming interface
• Not much C++ knowledge required to use it
• RAVL and STL
• RAVL and OpenCV
![Page 14: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/14.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL features
• C++ class library:• Basic containers• System interface• Maths, geometry inc. projective geometry - 2D & 3D• Image, video, 2D & 3D, audio and supporting tools• Pattern recognition• GUIs (GTK-based)• Applications (a few)
• Motivation:• lack of existing s/w (c. 1995)• C++ “difficult”• explicit memory management tedious
• Consistent programming interface
• Not much C++ knowledge required to use it
• RAVL and STL
• RAVL and OpenCV
![Page 15: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/15.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Support features
• Multi-platform: Linux, MS, ...
• Used for real products (Omniperception Ltd.)
• Source code available from SourceForge, under LGPL
• Simplified compilation system
• Recompiled and tested nightly
• Automatic documentation generation
• Full documentation on web:http://www.ee.surrey.ac.uk/CVSSP/Ravl
![Page 16: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/16.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Support features
• Multi-platform: Linux, MS, ...
• Used for real products (Omniperception Ltd.)
• Source code available from SourceForge, under LGPL
• Simplified compilation system
• Recompiled and tested nightly
• Automatic documentation generation
• Full documentation on web:http://www.ee.surrey.ac.uk/CVSSP/Ravl
![Page 17: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/17.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Support features
• Multi-platform: Linux, MS, ...
• Used for real products (Omniperception Ltd.)
• Source code available from SourceForge, under LGPL
• Simplified compilation system
• Recompiled and tested nightly
• Automatic documentation generation
• Full documentation on web:http://www.ee.surrey.ac.uk/CVSSP/Ravl
![Page 18: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/18.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Support features
• Multi-platform: Linux, MS, ...
• Used for real products (Omniperception Ltd.)
• Source code available from SourceForge, under LGPL
• Simplified compilation system
• Recompiled and tested nightly
• Automatic documentation generation
• Full documentation on web:http://www.ee.surrey.ac.uk/CVSSP/Ravl
![Page 19: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/19.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Support features
• Multi-platform: Linux, MS, ...
• Used for real products (Omniperception Ltd.)
• Source code available from SourceForge, under LGPL
• Simplified compilation system
• Recompiled and tested nightly
• Automatic documentation generation
• Full documentation on web:http://www.ee.surrey.ac.uk/CVSSP/Ravl
![Page 20: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/20.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Support features
• Multi-platform: Linux, MS, ...
• Used for real products (Omniperception Ltd.)
• Source code available from SourceForge, under LGPL
• Simplified compilation system
• Recompiled and tested nightly
• Automatic documentation generation
• Full documentation on web:http://www.ee.surrey.ac.uk/CVSSP/Ravl
![Page 21: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/21.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Support features
• Multi-platform: Linux, MS, ...
• Used for real products (Omniperception Ltd.)
• Source code available from SourceForge, under LGPL
• Simplified compilation system
• Recompiled and tested nightly
• Automatic documentation generation
• Full documentation on web:http://www.ee.surrey.ac.uk/CVSSP/Ravl
![Page 22: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/22.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Support features
• Multi-platform: Linux, MS, ...
• Used for real products (Omniperception Ltd.)
• Source code available from SourceForge, under LGPL
• Simplified compilation system
• Recompiled and tested nightly
• Automatic documentation generation
• Full documentation on web:http://www.ee.surrey.ac.uk/CVSSP/Ravl
![Page 23: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/23.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL C++ basics
• RAVL naming conventions
• RAVL namespaces — easily overlooked
• RAVL primitive typedefs — for more consistent wordlengths
• RAVL constants — under RavlConstN namespace:
RealT x = RavlConstN::pi;
using namespace RavlConstN;
RealT x = pi;
• IndexC - replacement for int that provides moreconsistent rounding behaviour
• RAVL coordinates : ?
-
x
y
![Page 24: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/24.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL C++ basics
• RAVL naming conventions
• RAVL namespaces — easily overlooked
• RAVL primitive typedefs — for more consistent wordlengths
• RAVL constants — under RavlConstN namespace:
RealT x = RavlConstN::pi;
using namespace RavlConstN;
RealT x = pi;
• IndexC - replacement for int that provides moreconsistent rounding behaviour
• RAVL coordinates : ?
-
x
y
![Page 25: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/25.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL C++ basics
• RAVL naming conventions
• RAVL namespaces — easily overlooked
• RAVL primitive typedefs — for more consistent wordlengths
• RAVL constants — under RavlConstN namespace:
RealT x = RavlConstN::pi;
using namespace RavlConstN;
RealT x = pi;
• IndexC - replacement for int that provides moreconsistent rounding behaviour
• RAVL coordinates : ?
-
x
y
![Page 26: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/26.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL C++ basics
• RAVL naming conventions
• RAVL namespaces — easily overlooked
• RAVL primitive typedefs — for more consistent wordlengths
• RAVL constants — under RavlConstN namespace:
RealT x = RavlConstN::pi;
using namespace RavlConstN;
RealT x = pi;
• IndexC - replacement for int that provides moreconsistent rounding behaviour
• RAVL coordinates : ?
-
x
y
![Page 27: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/27.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL C++ basics
• RAVL naming conventions
• RAVL namespaces — easily overlooked
• RAVL primitive typedefs — for more consistent wordlengths
• RAVL constants — under RavlConstN namespace:
RealT x = RavlConstN::pi;
using namespace RavlConstN;
RealT x = pi;
• IndexC - replacement for int that provides moreconsistent rounding behaviour
• RAVL coordinates : ?
-
x
y
![Page 28: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/28.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL C++ basics
• RAVL naming conventions
• RAVL namespaces — easily overlooked
• RAVL primitive typedefs — for more consistent wordlengths
• RAVL constants — under RavlConstN namespace:
RealT x = RavlConstN::pi;
using namespace RavlConstN;
RealT x = pi;
• IndexC - replacement for int that provides moreconsistent rounding behaviour
• RAVL coordinates : ?
-
x
y
![Page 29: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/29.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL C++ basics
• RAVL naming conventions
• RAVL namespaces — easily overlooked
• RAVL primitive typedefs — for more consistent wordlengths
• RAVL constants — under RavlConstN namespace:
RealT x = RavlConstN::pi;
using namespace RavlConstN;
RealT x = pi;
• IndexC - replacement for int that provides moreconsistent rounding behaviour
• RAVL coordinates : ?
-
x
y
![Page 30: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/30.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
RAVL C++ basics
• RAVL naming conventions
• RAVL namespaces — easily overlooked
• RAVL primitive typedefs — for more consistent wordlengths
• RAVL constants — under RavlConstN namespace:
RealT x = RavlConstN::pi;
using namespace RavlConstN;
RealT x = pi;
• IndexC - replacement for int that provides moreconsistent rounding behaviour
• RAVL coordinates : ?
-
x
y
![Page 31: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/31.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Member function syntax
In general, C++ classes have 2 ways of accessing memberfunctions:
• “struct” syntax:
a.b();
• “pointer” syntax:
a->b();
RAVL always uses the “struct” syntax, except where iteratorsare used.
![Page 32: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/32.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Member function syntax
In general, C++ classes have 2 ways of accessing memberfunctions:
• “struct” syntax:
a.b();
• “pointer” syntax:
a->b();
RAVL always uses the “struct” syntax, except where iteratorsare used.
![Page 33: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/33.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 34: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/34.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 35: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/35.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 36: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/36.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 37: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/37.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 38: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/38.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 39: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/39.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 40: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/40.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 41: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/41.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 42: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/42.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Reference counting: big / small objects
All “big” objects:
• are generally objects of indeterminate size (e.g. containers)
• have a handle (a reference-counted pointer)
• identified byinheritance of RCHandleC or BufferAccessC
(+ StringC)
“Small” objects behave like built-ins (int, double etc.)
−→ “JAVA-like” class interfaces−→ (almost) no pointers−→ automatic destruction−→ no memory leaks (I believe)−→ thread-safe for SMP
![Page 43: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/43.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Example: big object
Only the handle is copied in this example, not the contents(like a “C” array):
Array1dC<IntT>a(6);
a.Fill(27);
Array1dC<IntT>b = a;
b[4] = 55;
cout << a[4] << endl;
> myprog
55
Thus the value of a[4] is also changed.
![Page 44: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/44.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Copying big objects
Array1dC<DListC<IntT> > a(6);
// then initialise object ‘a’ somehow
// just copies array handle:
Array1dC<DListC<IntT> > b = a;
// copies array of list handles:
Array1dC<DListC<IntT> > b = a.Copy();
// copies everything (maybe - best avoided ’til ready):
Array1dC<DListC<IntT> > b = a.DeepCopy()
![Page 45: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/45.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Copying big objects
Array1dC<DListC<IntT> > a(6);
// then initialise object ‘a’ somehow
// just copies array handle:
Array1dC<DListC<IntT> > b = a;
// copies array of list handles:
Array1dC<DListC<IntT> > b = a.Copy();
// copies everything (maybe - best avoided ’til ready):
Array1dC<DListC<IntT> > b = a.DeepCopy()
![Page 46: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/46.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Copying big objects
Array1dC<DListC<IntT> > a(6);
// then initialise object ‘a’ somehow
// just copies array handle:
Array1dC<DListC<IntT> > b = a;
// copies array of list handles:
Array1dC<DListC<IntT> > b = a.Copy();
// copies everything (maybe - best avoided ’til ready):
Array1dC<DListC<IntT> > b = a.DeepCopy()
![Page 47: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/47.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Text and files
• StringC - for basic text processing. E.g.:
StringC a("Hello"); StringC b("World");
StringC c = a + ’ ’ + b;
cout << c.from(’o’) << endl;
generates “o World”.
• FilenameC , DirectoryC — derived from StringC toprovide information on and manipulate file properties anddirectories:
FilenameC f("myfile.txt");
if (f.Exists()) {
f.SetPermissions(0444);
f.Rename("yourfile.txt");
}
• Using “-” as a file name denotes stdin or stdout asappropriate.
![Page 48: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/48.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Text and files
• StringC - for basic text processing. E.g.:
StringC a("Hello"); StringC b("World");
StringC c = a + ’ ’ + b;
cout << c.from(’o’) << endl;
generates “o World”.
• FilenameC , DirectoryC — derived from StringC toprovide information on and manipulate file properties anddirectories:
FilenameC f("myfile.txt");
if (f.Exists()) {
f.SetPermissions(0444);
f.Rename("yourfile.txt");
}
• Using “-” as a file name denotes stdin or stdout asappropriate.
![Page 49: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/49.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Text and files
• StringC - for basic text processing. E.g.:
StringC a("Hello"); StringC b("World");
StringC c = a + ’ ’ + b;
cout << c.from(’o’) << endl;
generates “o World”.
• FilenameC , DirectoryC — derived from StringC toprovide information on and manipulate file properties anddirectories:
FilenameC f("myfile.txt");
if (f.Exists()) {
f.SetPermissions(0444);
f.Rename("yourfile.txt");
}
• Using “-” as a file name denotes stdin or stdout asappropriate.
![Page 50: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/50.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Text and files
• StringC - for basic text processing. E.g.:
StringC a("Hello"); StringC b("World");
StringC c = a + ’ ’ + b;
cout << c.from(’o’) << endl;
generates “o World”.
• FilenameC , DirectoryC — derived from StringC toprovide information on and manipulate file properties anddirectories:
FilenameC f("myfile.txt");
if (f.Exists()) {
f.SetPermissions(0444);
f.Rename("yourfile.txt");
}
• Using “-” as a file name denotes stdin or stdout asappropriate.
![Page 51: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/51.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Command-line options
OptionC handles processing of command-line options andparameters. This code fragment:
OptionC opt(argc, argv);
bool select (opt.Boolean("bw", "b&w (default: colour)"));
RealT gamma (opt.Real ("gamma", 1.0, "display gamma"));
Index2dC size (opt.Index2d("size", 576, 720, "image size"));
StringC logFile (opt.String ("log", "-", "log file"));
StringC opName (opt.String ("", "out.ppm", "o/p image"));
opt.Compulsory("size");
opt.Check();
might handle this command line:
myprog file.pgm -bw -size 768 1024
./ The default value of a boolean option is always false.
./ Options without tags (“opName”) must be handled last.
./ File name "-" is used in RAVL for standard input & output.
![Page 52: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/52.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Command-line options
OptionC handles processing of command-line options andparameters. This code fragment:
OptionC opt(argc, argv);
bool select (opt.Boolean("bw", "b&w (default: colour)"));
RealT gamma (opt.Real ("gamma", 1.0, "display gamma"));
Index2dC size (opt.Index2d("size", 576, 720, "image size"));
StringC logFile (opt.String ("log", "-", "log file"));
StringC opName (opt.String ("", "out.ppm", "o/p image"));
opt.Compulsory("size");
opt.Check();
might handle this command line:
myprog file.pgm -bw -size 768 1024
./ The default value of a boolean option is always false.
./ Options without tags (“opName”) must be handled last.
./ File name "-" is used in RAVL for standard input & output.
![Page 53: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/53.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Command-line options
OptionC handles processing of command-line options andparameters. This code fragment:
OptionC opt(argc, argv);
bool select (opt.Boolean("bw", "b&w (default: colour)"));
RealT gamma (opt.Real ("gamma", 1.0, "display gamma"));
Index2dC size (opt.Index2d("size", 576, 720, "image size"));
StringC logFile (opt.String ("log", "-", "log file"));
StringC opName (opt.String ("", "out.ppm", "o/p image"));
opt.Compulsory("size");
opt.Check();
might handle this command line:
myprog file.pgm -bw -size 768 1024
./ The default value of a boolean option is always false.
./ Options without tags (“opName”) must be handled last.
./ File name "-" is used in RAVL for standard input & output.
![Page 54: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/54.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Command-line options (cont.)
The command:
myprog -help
generates this o/p:
Usage: myprog [options]
-bw (false) [false] b&w (default: colour)
-gamma (1) [1] display gamma
-size (576 720) [576 720] image size
-log (-) [-] log file
arg (out.ppm) [out.ppm] o/p image name
-help (true) [false] Print usage information.
Dependencies:
-size is compulsory.
Command-line errors produce a similar output.
![Page 55: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/55.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Command-line options (cont.)
The command:
myprog -help
generates this o/p:
Usage: myprog [options]
-bw (false) [false] b&w (default: colour)
-gamma (1) [1] display gamma
-size (576 720) [576 720] image size
-log (-) [-] log file
arg (out.ppm) [out.ppm] o/p image name
-help (true) [false] Print usage information.
Dependencies:
-size is compulsory.
Command-line errors produce a similar output.
![Page 56: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/56.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Streams
• IStreamC / OStreamC: provide the usual text streamI/O.
• BinIStreamC / BinOStreamC: corresponding binary I/O- reads back in exactly what is written out (c.f. fread /
fwrite).
• StrIStreamC / StrOStreamC: like IStreamC /
OStreamC, but reads from / writes to a string (likesscanf / sprintf). Can also be used (with care) toinitialise small arrays:
SArray1dC<RealT> coeffs(5);
StrIStreamC ("5 0.363 0.291 0.135 0.012 -0.030") >> coeffs;
• XMLIStreamC / XMLOStreamC: additional XML supportfor linear XML file handling.
![Page 57: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/57.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Streams
• IStreamC / OStreamC: provide the usual text streamI/O.
• BinIStreamC / BinOStreamC: corresponding binary I/O- reads back in exactly what is written out (c.f. fread /
fwrite).
• StrIStreamC / StrOStreamC: like IStreamC /
OStreamC, but reads from / writes to a string (likesscanf / sprintf). Can also be used (with care) toinitialise small arrays:
SArray1dC<RealT> coeffs(5);
StrIStreamC ("5 0.363 0.291 0.135 0.012 -0.030") >> coeffs;
• XMLIStreamC / XMLOStreamC: additional XML supportfor linear XML file handling.
![Page 58: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/58.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Streams
• IStreamC / OStreamC: provide the usual text streamI/O.
• BinIStreamC / BinOStreamC: corresponding binary I/O- reads back in exactly what is written out (c.f. fread /
fwrite).
• StrIStreamC / StrOStreamC: like IStreamC /
OStreamC, but reads from / writes to a string (likesscanf / sprintf). Can also be used (with care) toinitialise small arrays:
SArray1dC<RealT> coeffs(5);
StrIStreamC ("5 0.363 0.291 0.135 0.012 -0.030") >> coeffs;
• XMLIStreamC / XMLOStreamC: additional XML supportfor linear XML file handling.
![Page 59: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/59.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Streams
• IStreamC / OStreamC: provide the usual text streamI/O.
• BinIStreamC / BinOStreamC: corresponding binary I/O- reads back in exactly what is written out (c.f. fread /
fwrite).
• StrIStreamC / StrOStreamC: like IStreamC /
OStreamC, but reads from / writes to a string (likesscanf / sprintf). Can also be used (with care) toinitialise small arrays:
SArray1dC<RealT> coeffs(5);
StrIStreamC ("5 0.363 0.291 0.135 0.012 -0.030") >> coeffs;
• XMLIStreamC / XMLOStreamC: additional XML supportfor linear XML file handling.
![Page 60: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/60.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Containers
Series of template classes that generate complex objects:
• arrays: Array1dC, Array2dC, Array3dC
• “simple” versions: SArray1dC, SArray2dC, SArray3dC
• dynamic 1D arrays: DArray1dC
• doubly linked lists: DListC
• hash tables: HashC, RCHashC
• trees
• queues
• ......
![Page 61: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/61.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Iterators for containers
“Intelligent pointers”: Each container class has one or moreassociated iterators to provide efficient indexing through thecontainer object. So, to take square root of array values:
#include "Ravl/Array1d.hh"
#include "Ravl/Array1dIter.hh"
using namespace RavlN;
int main() {Array1dC<RealT>a(1,4);
for (Array1dIterC<RealT> i(a); i; ++i) {*i = Sqrt(i.Index());
}cout << a << endl;
}
¨ Compiler options for array bound checking.
![Page 62: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/62.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Iterators for containers
“Intelligent pointers”: Each container class has one or moreassociated iterators to provide efficient indexing through thecontainer object. So, to take square root of array values:
#include "Ravl/Array1d.hh"
#include "Ravl/Array1dIter.hh"
using namespace RavlN;
int main() {Array1dC<RealT>a(1,4);
for (Array1dIterC<RealT> i(a); i; ++i) {*i = Sqrt(i.Index());
}cout << a << endl;
}
¨ Compiler options for array bound checking.
![Page 63: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/63.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Iterators for containers
“Intelligent pointers”: Each container class has one or moreassociated iterators to provide efficient indexing through thecontainer object. So, to take square root of array values:
#include "Ravl/Array1d.hh"
#include "Ravl/Array1dIter.hh"
using namespace RavlN;
int main() {Array1dC<RealT>a(1,4);
for (Array1dIterC<RealT> i(a); i; ++i) {*i = Sqrt(i.Index());
}cout << a << endl;
}
¨ Compiler options for array bound checking.
![Page 64: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/64.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compound iterators
• You can iterate over more than one object using a singlecompound iterator.
• E.g. to copy one array to another that is offset from thefirst:
#include "Ravl/Array1d.hh"
#include "Ravl/Array1dIter2.hh"
#include "Ravl/Index.hh"
using namespace RavlN;
int main() {
Array1dC<RealT>a(4);
Array1dC<IndexC>b(3,6);
a.Fill(8.6);
for (Array1dIter2C<RealT,IndexC> i(a,b); i; ++i) {
i.Data2() = i.Data1();
}
}
![Page 65: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/65.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compound iterators
• You can iterate over more than one object using a singlecompound iterator.
• E.g. to copy one array to another that is offset from thefirst:
#include "Ravl/Array1d.hh"
#include "Ravl/Array1dIter2.hh"
#include "Ravl/Index.hh"
using namespace RavlN;
int main() {
Array1dC<RealT>a(4);
Array1dC<IndexC>b(3,6);
a.Fill(8.6);
for (Array1dIter2C<RealT,IndexC> i(a,b); i; ++i) {
i.Data2() = i.Data1();
}
}
![Page 66: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/66.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Images
ImageC : 2-D array with extensions
• Can have any pixel type - byte, integer, real, boolean ....
• Variety of pre-defined pixel types
• Image border is object of class ImageRectangleC
• Comprehensive file and device I/O for images and video
• Image processing / computer vision algorithms
![Page 67: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/67.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Filtering images
Example using user-specified mask:
#include "Ravl/Image/ConvolveSeparable2d.hh"
#include "Ravl/IO.hh"
#include "Ravl/StrStream.hh"
using namespace RavlN;
using namespace RavlImageN;
int main (int argc, char* argv[]) {
ImageC<RealT> im; Load ("image.pgm", im);
Array1dC<RealT> coeffs;
StrIStreamC ("-2 2 1 3 5 3 1") >> coeffs;
ConvolveSeparable2dC<RealT> filter(coeffs);
im = filter.Apply(im);
cout << im.Frame() << endl;
}
Note symmetric imageshrinkage:> myprog
2 297 2 197
filtered frame
original frame(0,0)
(2,2)
![Page 68: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/68.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Indexing images
Really bad:
for (IntT x(0); x<576; ++x) for (IntT y(0); y<720; ++y)
im[x][y] += 3;
Slightly better:
for (IntT x(0); x<im.Rows(); ++x) for (IntT y(0); y<im.Cols(); ++y)
im[x][y] += 3;
Better:
for (IndexC x(im.TRow()); x<=im.BRow(); ++x)
for (IndexC y(im.LCol()); y<=im.RCol(); ++y)
im[x][y] += 3;
Best (and fastest):
for (Array2dIterC<IntT>i(im); i; ++i)
*i += 3;
![Page 69: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/69.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Indexing images
Really bad:
for (IntT x(0); x<576; ++x) for (IntT y(0); y<720; ++y)
im[x][y] += 3;
Slightly better:
for (IntT x(0); x<im.Rows(); ++x) for (IntT y(0); y<im.Cols(); ++y)
im[x][y] += 3;
Better:
for (IndexC x(im.TRow()); x<=im.BRow(); ++x)
for (IndexC y(im.LCol()); y<=im.RCol(); ++y)
im[x][y] += 3;
Best (and fastest):
for (Array2dIterC<IntT>i(im); i; ++i)
*i += 3;
![Page 70: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/70.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Indexing images
Really bad:
for (IntT x(0); x<576; ++x) for (IntT y(0); y<720; ++y)
im[x][y] += 3;
Slightly better:
for (IntT x(0); x<im.Rows(); ++x) for (IntT y(0); y<im.Cols(); ++y)
im[x][y] += 3;
Better:
for (IndexC x(im.TRow()); x<=im.BRow(); ++x)
for (IndexC y(im.LCol()); y<=im.RCol(); ++y)
im[x][y] += 3;
Best (and fastest):
for (Array2dIterC<IntT>i(im); i; ++i)
*i += 3;
![Page 71: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/71.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Indexing images
Really bad:
for (IntT x(0); x<576; ++x) for (IntT y(0); y<720; ++y)
im[x][y] += 3;
Slightly better:
for (IntT x(0); x<im.Rows(); ++x) for (IntT y(0); y<im.Cols(); ++y)
im[x][y] += 3;
Better:
for (IndexC x(im.TRow()); x<=im.BRow(); ++x)
for (IndexC y(im.LCol()); y<=im.RCol(); ++y)
im[x][y] += 3;
Best (and fastest):
for (Array2dIterC<IntT>i(im); i; ++i)
*i += 3;
![Page 72: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/72.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Sliding one image around another
The Rectangle2dIterC iterator allows one image to scan overanother larger one:
Iterator scans this image over this one
— e.g. for image convolution
![Page 73: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/73.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Subimages
Construct new image from old:
ImageC<ByteT> a(576,720);
a.Fill(12);
ImageC<ByteT> b(a, IndexRange2dC(100,400,200,700));
b.Fill(135);
Data is not copied when constructing b. So a finally is:
![Page 74: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/74.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Image I/O
Image I/O using Load() / Save()
• can be files or devices (“ virtual files ”)
• conversion between pixel types is automaticE.g. conversion of RGB 8-bit file to grey-scale float object:
#include "Ravl/IO.hh"
#include "Ravl/Image/Image.hh"
using namespace RavlN;
using namespace RavlImageN;
int main (int argc, char* argv[]) {ImageC<RealT> im;
if (! Load ("image.png", im)) cerr << "panic!!" << endl;
Save ("image.pgm", im);
Save ( "@X:image" , im); // write to screen with title "image"
}
![Page 75: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/75.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Image I/O
Image I/O using Load() / Save()
• can be files or devices (“ virtual files ”)
• conversion between pixel types is automaticE.g. conversion of RGB 8-bit file to grey-scale float object:
#include "Ravl/IO.hh"
#include "Ravl/Image/Image.hh"
using namespace RavlN;
using namespace RavlImageN;
int main (int argc, char* argv[]) {ImageC<RealT> im;
if (! Load ("image.png", im)) cerr << "panic!!" << endl;
Save ("image.pgm", im);
Save ( "@X:image" , im); // write to screen with title "image"
}
![Page 76: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/76.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Image I/O (cont.)
Corresponding defs.mk file:
MAINS= myprog.cc
PROGLIBS = RavlImageIO RavlExtImgIO RavlDPDisplay
![Page 77: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/77.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Video I/O
Image sequence I/O — to read and write a sequence:
#include "Ravl/DP/SequenceIO.hh"
#include "Ravl/Image/Image.hh"
#include "Ravl/Image/ByteRGBValue.hh"
using namespace RavlN;
using namespace RavlImageN;
int main (int argc, char* argv[]) {if (argc < 3) exit(-1);
DPIPortC<ImageC<ByteRGBValueC> > in;
if(!OpenISequence(in, argv[1])) exit(-2);
DPOPortC<ImageC<ByteRGBValueC> > out;
if(!OpenOSequence(out, argv[2])) exit (-3);
ImageC<ByteRGBValueC> im;
while(in.Get(im))
out.Put(im);
}
![Page 78: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/78.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Video I/O (cont.)
Corresponding defs.mk file:
MAINS= seqio.cc
PROGLIBS = RavlVideoIO RavlLibFFmpeg RavlDPDisplay
Run it like this to convert to sequence of ‘ppm’s:
seqio movie.mpeg tmp.ppm
Run it like this to display the file:
seqio movie.mpeg @X 1
Run it like this to display a camera o/p (includeRavlImgIOV4L library):
seqio @V4L @X
1To run this example, you need to (a) be using xpdf to run the presentation, (b) have compiled up the
‘‘seqio’’ example, and (c) have ‘‘movie.mpeg’’ in your current directory.
![Page 79: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/79.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Video I/O (cont.)
Corresponding defs.mk file:
MAINS= seqio.cc
PROGLIBS = RavlVideoIO RavlLibFFmpeg RavlDPDisplay
Run it like this to convert to sequence of ‘ppm’s:
seqio movie.mpeg tmp.ppm
Run it like this to display the file:
seqio movie.mpeg @X 1
Run it like this to display a camera o/p (includeRavlImgIOV4L library):
seqio @V4L @X
1To run this example, you need to (a) be using xpdf to run the presentation, (b) have compiled up the
‘‘seqio’’ example, and (c) have ‘‘movie.mpeg’’ in your current directory.
![Page 80: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/80.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Video I/O (cont.)
Corresponding defs.mk file:
MAINS= seqio.cc
PROGLIBS = RavlVideoIO RavlLibFFmpeg RavlDPDisplay
Run it like this to convert to sequence of ‘ppm’s:
seqio movie.mpeg tmp.ppm
Run it like this to display the file:
seqio movie.mpeg @X 1
Run it like this to display a camera o/p (includeRavlImgIOV4L library):
seqio @V4L @X
1To run this example, you need to (a) be using xpdf to run the presentation, (b) have compiled up the
‘‘seqio’’ example, and (c) have ‘‘movie.mpeg’’ in your current directory.
![Page 81: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/81.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Video I/O (cont.)
Corresponding defs.mk file:
MAINS= seqio.cc
PROGLIBS = RavlVideoIO RavlLibFFmpeg RavlDPDisplay
Run it like this to convert to sequence of ‘ppm’s:
seqio movie.mpeg tmp.ppm
Run it like this to display the file:
seqio movie.mpeg @X 1
Run it like this to display a camera o/p (includeRavlImgIOV4L library):
seqio @V4L @X
1To run this example, you need to (a) be using xpdf to run the presentation, (b) have compiled up the
‘‘seqio’’ example, and (c) have ‘‘movie.mpeg’’ in your current directory.
![Page 82: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/82.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
More general I/O
Automatic numbering of file sequences:
• OpenOSequence(out,"a.ppm") createsa0.ppm, a1.ppm, ...., a10.ppm, ....
• OpenOSequence(out,"a%4d.ppm") createsa0000.ppm, a0001.ppm, ...., a0010.ppm, ....
• OpenISequence(in,"a.ppm") will read either style.
• Load(), Save(), OpenISequence, OpenOSequence canalso be used for reading writing arbitrary objects (includingimages) as text files:
ImageC<IntT>
0 1 0 2
32 35 45
33 39 42
![Page 83: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/83.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
More general I/O
Automatic numbering of file sequences:
• OpenOSequence(out,"a.ppm") createsa0.ppm, a1.ppm, ...., a10.ppm, ....
• OpenOSequence(out,"a%4d.ppm") createsa0000.ppm, a0001.ppm, ...., a0010.ppm, ....
• OpenISequence(in,"a.ppm") will read either style.
• Load(), Save(), OpenISequence, OpenOSequence canalso be used for reading writing arbitrary objects (includingimages) as text files:
ImageC<IntT>
0 1 0 2
32 35 45
33 39 42
![Page 84: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/84.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
More general I/O
Automatic numbering of file sequences:
• OpenOSequence(out,"a.ppm") createsa0.ppm, a1.ppm, ...., a10.ppm, ....
• OpenOSequence(out,"a%4d.ppm") createsa0000.ppm, a0001.ppm, ...., a0010.ppm, ....
• OpenISequence(in,"a.ppm") will read either style.
• Load(), Save(), OpenISequence, OpenOSequence canalso be used for reading writing arbitrary objects (includingimages) as text files:
ImageC<IntT>
0 1 0 2
32 35 45
33 39 42
![Page 85: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/85.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
More general I/O
Automatic numbering of file sequences:
• OpenOSequence(out,"a.ppm") createsa0.ppm, a1.ppm, ...., a10.ppm, ....
• OpenOSequence(out,"a%4d.ppm") createsa0000.ppm, a0001.ppm, ...., a0010.ppm, ....
• OpenISequence(in,"a.ppm") will read either style.
• Load(), Save(), OpenISequence, OpenOSequence canalso be used for reading writing arbitrary objects (includingimages) as text files:
ImageC<IntT>
0 1 0 2
32 35 45
33 39 42
![Page 86: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/86.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Graphics and GUIs
![Page 87: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/87.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Maths
• linear algebra
• Euclidean geometry
• projective geometry
• mosaicking:
• ......
![Page 88: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/88.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Pattern recognition
Some standard classifiers:
• SVM
• GMM
• ANN
• KNN
• ......
Optimisers:
• conjugate gradient
• ......
![Page 89: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/89.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
O/S interfaces: threads
1 Define the function to be launched as a thread, e.g.:
bool PrintNumber(int &i) {
cout << "PrintNumber called with value " << i << endl;
return true;
}
2 Create a “ trigger ”:
TriggerC myTrigger = Trigger(&PrintNumber, 53);
3 Then launch it as a separate thread :
LaunchThreadC thread = LaunchThread (myTrigger) ;
4 and wait for it to finish:
thread.Wait()
![Page 90: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/90.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
QMake
QMake : a compilation tool
![Page 91: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/91.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling main programs
To compile (1 or more) main program(s) in a directory:
• Create a file called defs.mk in that directory, consisting ofone line to tell QMake what the files are called:
MAINS = main1.cc main2.cc main3.cc
• Execute the command qm
If your program(s) need RAVL libraries that QMake cannot findautomatically at link time (mainly I/O libs), you will need toadd them to the defs.mk file. E.g.:
MAINS = main1.cc main2.cc main3.cc
PROGLIBS = RavlVideoIO RavlLibFFmpeg RavlDPDisplay
![Page 92: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/92.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling main programs
To compile (1 or more) main program(s) in a directory:
• Create a file called defs.mk in that directory, consisting ofone line to tell QMake what the files are called:
MAINS = main1.cc main2.cc main3.cc
• Execute the command qm
If your program(s) need RAVL libraries that QMake cannot findautomatically at link time (mainly I/O libs), you will need toadd them to the defs.mk file. E.g.:
MAINS = main1.cc main2.cc main3.cc
PROGLIBS = RavlVideoIO RavlLibFFmpeg RavlDPDisplay
![Page 93: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/93.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling main programs
To compile (1 or more) main program(s) in a directory:
• Create a file called defs.mk in that directory, consisting ofone line to tell QMake what the files are called:
MAINS = main1.cc main2.cc main3.cc
• Execute the command qm
If your program(s) need RAVL libraries that QMake cannot findautomatically at link time (mainly I/O libs), you will need toadd them to the defs.mk file. E.g.:
MAINS = main1.cc main2.cc main3.cc
PROGLIBS = RavlVideoIO RavlLibFFmpeg RavlDPDisplay
![Page 94: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/94.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling main programs
To compile (1 or more) main program(s) in a directory:
• Create a file called defs.mk in that directory, consisting ofone line to tell QMake what the files are called:
MAINS = main1.cc main2.cc main3.cc
• Execute the command qm
If your program(s) need RAVL libraries that QMake cannot findautomatically at link time (mainly I/O libs), you will need toadd them to the defs.mk file. E.g.:
MAINS = main1.cc main2.cc main3.cc
PROGLIBS = RavlVideoIO RavlLibFFmpeg RavlDPDisplay
![Page 95: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/95.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Adding extra libraries
You can including your own class and header files:
MAINS = main1.cc main2.cc main3.cc
HEADERS = header1.hh header2.hh
SOURCES = class1.cc class2.cc
And much more...
![Page 96: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/96.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Adding extra libraries
You can including your own class and header files:
MAINS = main1.cc main2.cc main3.cc
HEADERS = header1.hh header2.hh
SOURCES = class1.cc class2.cc
And much more...
![Page 97: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/97.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake
• qm is just an alias for make:> alias qm
gmake -f /vol/vssp/localsoft/Auto/linux/Ravl/share/RAVL/QMake/QMake.mk USERBUILD=1 !* && rehash
• For faster linking:qm shared
• For faster runtime:qm optshared
• Debugging using ddd / gdb:qm debugshared
• a bit of help in debugging RAVL• qm shared, qm debugshared → run-time array bound
checking
• $PROJECT OUT, /tmp/<user>/qm can always be deleted:qm distclean
![Page 98: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/98.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake
• qm is just an alias for make:> alias qm
gmake -f /vol/vssp/localsoft/Auto/linux/Ravl/share/RAVL/QMake/QMake.mk USERBUILD=1 !* && rehash
• For faster linking:qm shared
• For faster runtime:qm optshared
• Debugging using ddd / gdb:qm debugshared
• a bit of help in debugging RAVL• qm shared, qm debugshared → run-time array bound
checking
• $PROJECT OUT, /tmp/<user>/qm can always be deleted:qm distclean
![Page 99: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/99.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake
• qm is just an alias for make:> alias qm
gmake -f /vol/vssp/localsoft/Auto/linux/Ravl/share/RAVL/QMake/QMake.mk USERBUILD=1 !* && rehash
• For faster linking:qm shared
• For faster runtime:qm optshared
• Debugging using ddd / gdb:qm debugshared
• a bit of help in debugging RAVL• qm shared, qm debugshared → run-time array bound
checking
• $PROJECT OUT, /tmp/<user>/qm can always be deleted:qm distclean
![Page 100: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/100.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake
• qm is just an alias for make:> alias qm
gmake -f /vol/vssp/localsoft/Auto/linux/Ravl/share/RAVL/QMake/QMake.mk USERBUILD=1 !* && rehash
• For faster linking:qm shared
• For faster runtime:qm optshared
• Debugging using ddd / gdb:qm debugshared
• a bit of help in debugging RAVL• qm shared, qm debugshared → run-time array bound
checking
• $PROJECT OUT, /tmp/<user>/qm can always be deleted:qm distclean
![Page 101: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/101.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake
• qm is just an alias for make:> alias qm
gmake -f /vol/vssp/localsoft/Auto/linux/Ravl/share/RAVL/QMake/QMake.mk USERBUILD=1 !* && rehash
• For faster linking:qm shared
• For faster runtime:qm optshared
• Debugging using ddd / gdb:qm debugshared
• a bit of help in debugging RAVL• qm shared, qm debugshared → run-time array bound
checking
• $PROJECT OUT, /tmp/<user>/qm can always be deleted:qm distclean
![Page 102: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/102.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake
• qm is just an alias for make:> alias qm
gmake -f /vol/vssp/localsoft/Auto/linux/Ravl/share/RAVL/QMake/QMake.mk USERBUILD=1 !* && rehash
• For faster linking:qm shared
• For faster runtime:qm optshared
• Debugging using ddd / gdb:qm debugshared
• a bit of help in debugging RAVL• qm shared, qm debugshared → run-time array bound
checking
• $PROJECT OUT, /tmp/<user>/qm can always be deleted:qm distclean
![Page 103: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/103.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake
• qm is just an alias for make:> alias qm
gmake -f /vol/vssp/localsoft/Auto/linux/Ravl/share/RAVL/QMake/QMake.mk USERBUILD=1 !* && rehash
• For faster linking:qm shared
• For faster runtime:qm optshared
• Debugging using ddd / gdb:qm debugshared
• a bit of help in debugging RAVL• qm shared, qm debugshared → run-time array bound
checking
• $PROJECT OUT, /tmp/<user>/qm can always be deleted:qm distclean
![Page 104: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/104.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake
• qm is just an alias for make:> alias qm
gmake -f /vol/vssp/localsoft/Auto/linux/Ravl/share/RAVL/QMake/QMake.mk USERBUILD=1 !* && rehash
• For faster linking:qm shared
• For faster runtime:qm optshared
• Debugging using ddd / gdb:qm debugshared
• a bit of help in debugging RAVL• qm shared, qm debugshared → run-time array bound
checking
• $PROJECT OUT, /tmp/<user>/qm can always be deleted:qm distclean
![Page 105: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/105.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake (cont.)
Static or shared (dynamic) libraries?
• static libs (use qm, qm debug, qm opt)– good for long-running jobs (libs can’t change)
• shared libs (use qm shared, qm debugshared, qm
optshared)– good for development (fast linking)
“Complete” list of qm commands :
qm help
![Page 106: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/106.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake (cont.)
Static or shared (dynamic) libraries?
• static libs (use qm, qm debug, qm opt)– good for long-running jobs (libs can’t change)
• shared libs (use qm shared, qm debugshared, qm
optshared)– good for development (fast linking)
“Complete” list of qm commands :
qm help
![Page 107: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/107.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Compiling with QMake (cont.)
Static or shared (dynamic) libraries?
• static libs (use qm, qm debug, qm opt)– good for long-running jobs (libs can’t change)
• shared libs (use qm shared, qm debugshared, qm
optshared)– good for development (fast linking)
“Complete” list of qm commands :
qm help
![Page 108: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/108.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Documentation
• Class documentation automatically generated fromheader files
• Background documentation in branches , not in
class leaves
• - while examples are usually in class leaves
• Search engine
• 2 lots of documentation: internal , publicIn each there is:
• the blue users’ version , and
• the green developers’ one
![Page 109: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/109.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Documentation
• Class documentation automatically generated fromheader files
• Background documentation in branches , not in
class leaves
• - while examples are usually in class leaves
• Search engine
• 2 lots of documentation: internal , publicIn each there is:
• the blue users’ version , and
• the green developers’ one
![Page 110: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/110.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Documentation
• Class documentation automatically generated fromheader files
• Background documentation in branches , not in
class leaves
• - while examples are usually in class leaves
• Search engine
• 2 lots of documentation: internal , publicIn each there is:
• the blue users’ version , and
• the green developers’ one
![Page 111: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/111.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Documentation
• Class documentation automatically generated fromheader files
• Background documentation in branches , not in
class leaves
• - while examples are usually in class leaves
• Search engine
• 2 lots of documentation: internal , publicIn each there is:
• the blue users’ version , and
• the green developers’ one
![Page 112: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/112.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Documentation
• Class documentation automatically generated fromheader files
• Background documentation in branches , not in
class leaves
• - while examples are usually in class leaves
• Search engine
• 2 lots of documentation: internal , publicIn each there is:
• the blue users’ version , and
• the green developers’ one
![Page 113: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/113.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Documentation
• Class documentation automatically generated fromheader files
• Background documentation in branches , not in
class leaves
• - while examples are usually in class leaves
• Search engine
• 2 lots of documentation: internal , publicIn each there is:
• the blue users’ version , and
• the green developers’ one
![Page 114: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/114.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Documentation
• Class documentation automatically generated fromheader files
• Background documentation in branches , not in
class leaves
• - while examples are usually in class leaves
• Search engine
• 2 lots of documentation: internal , publicIn each there is:
• the blue users’ version , and
• the green developers’ one
![Page 115: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/115.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Finally....
• Contributions always welcome (including C):• for RAVL itself• for use within CVSSP
• Go tohttp://www.ee.surrey.ac.uk/CVSSP/Ravl/RavlIntro.html
and read all about it.
• Tell us what is missing
![Page 116: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/116.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Finally....
• Contributions always welcome (including C):• for RAVL itself• for use within CVSSP
• Go tohttp://www.ee.surrey.ac.uk/CVSSP/Ravl/RavlIntro.html
and read all about it.
• Tell us what is missing
![Page 117: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/117.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
Finally....
• Contributions always welcome (including C):• for RAVL itself• for use within CVSSP
• Go tohttp://www.ee.surrey.ac.uk/CVSSP/Ravl/RavlIntro.html
and read all about it.
• Tell us what is missing
![Page 118: Introduction Basics Programming in C++ using · 2018-03-07 · Introduction Basics Base classes Containers Images & video Other classes etc. QMake Other bits RAVL features C++ class](https://reader034.fdocuments.in/reader034/viewer/2022042118/5e97a6df25849640a41a1d3e/html5/thumbnails/118.jpg)
Introduction
Basics
Base classes
Containers
Images &video
Other classesetc.
QMake
Other bits
We are here to help