Introduction to C – Classes: Heredity, Adjustment, Friends, abstract – Part5

Heredity

Classes can inherit functions and member variables of other classes.

Class A{
public:
 void f();
};
Class B : public A{};//B erbt public von A
B* b = new B;
b.f(); //Funktion ist vorhanden, da geerbt
  • public: can be accessed from anywhere on these elements
  • protected: Access to member only of parent classes and derived classes (and the class, that defines the item)
  • private: only the defining class more…

Introduction to C – Functions and Operator Overloading (Overloading) – Part4

Functions Overloading

  • it is possible to use a function name repeatedly, if the transfer parameters are not equal, and thus clear to the compiler is, the function to be called
int a(int b);
int a(double b);
int a(char*);

int x = a(5); //ist ok, 5 ist int, 5.0 wäre double
  • is not unique:
int a(int b);
double a(int b);

int x = a(5); //welche Funktion nehmen, error

and in default arguments:

int a(int b, int c = 3);
int a(int b);

int x = a(5); //welche Funktion nehmen, error

Overloading of functions is possible through Name-Mangeling: more…

Introduction to C – Data Types, Casting, Classes – Part3

Data Types

Implicit casting

  • automatic Casting in numbers “from smaller to larger” Data Types

Ranking:

unsigned long long ("größter Wert") long long long double double float unsigned long long unsigned (int) int short bool
  • casting not const to const, Credentials
T->T& T&->T T->const T T*->const T* T&->const T&

Explzite typecast

  • mit static_cast<>
  • in elementary (simple) Data Types
bool i = true; int y = static_cast<int> i; //y ist 1
  • to constants casten, with const_cast<>
  • critical casting with reinterpret_cast<>
struct A{} a; struct B{} b; struct A *pa = &a; struct B *pb = pa; //Fehler, nicht derselbe Datentyp, obwohl selber Struct-Inhalt struct B *pb = reinterpret_cast<B*>(pa); //ist ok

Inline Functions more…

Introduction to C – Zeiger, Pointer,Credentials – Part2

A pointer is a variable, the memory address of the (RAMs) another variable contains.

int i = 100;
int* pi = &i;
cout << pi; //Speicheradresse: z.B. 0x000026

Dereferencing pointers: *Operator

  • access the value, on the one hand(Pointer) shows
int i = 100;
int* pi = &i;
cout << *pi; //100
cout << pi; //Speicheradresse: z.B. 0x000026

void pointer

  • Pointer to unknown type -> dynamic
  • must be cast in access
int i=10;
void* pi;
pi=&i;
cout << *(int*) pi;

NULL pointer

  • Free memory of the pointer, e.g.. to prevent zombie hands, pointing to non-existent objects
int i = 100;
int* pi = &i;
pi = NULL;

Pointers to constants

  • must also be const, not so changeable
const int i = 100;
const int* pi = &i;

Pointers to Functions

int f(float a){return 1;};
int (*pf)(float) = &f;
int x = (*pf)(1,5);

Pointers to functions

Call by Value more…

Introduction to C – Advantages, Compiler, Namespaces – Part1

Advantages of C

  • very good performance, Code is compiled and executed on the operating system. No interpretation, such as Java, Code can only be executed by the JVM
  • it can also be installed C, selber Compiler: GNU C-Compiler

Advantages of C over the previous C

  • stricter type checking, runtime / LateBinding
  • Object orientation possible
  • improved memory management
  • Exceptions Handling

The C compilation process: How does the GNU compiler?

  1. x.cc and x.h as output files
  2. x.i, Header files include, Hardware platform query, Preprocessor directives execute (e.g.. #define, Variables / functions will be replaced in the code)
  3. x.o, mit C Compiler g , Generate machine code assembler, This is hardware- and operating system dependent
  4. Linker writes the addresses of the libs and links all object files (.the) together
  5. x.exe, executable shell file generate

Declaration, Definition, Initialization and assignment in C

Declaration

  • No memory allocation
  • as often as possible
inf f(char c);
extern char c;
inf f(char c);

Definition more…

Microsoft's technical evolution of the Kinect

The work on the Kinect launched at Microsoft after Nintendo 2005 had released their Wii console with the Wii Remote controller. In the actual control but has been since 2003 worked: see History of NUI / Kinect.

The development of the hardware

Were initially 2 Team established, which is based on 2 different technologies should build the Kinect. The technology came from the company 3DV (bought for $ 35 million) and PrimeSense (Israeli an independent research company). In the end only managed the PrimeSense technology, the high demands on technology to accomplish and to build a prototype, the RGB camera, Could infrared sensor and an infrared light sensor contained and render depth data at 30fps. The speed was made possible by, that the depth data were determined using the infrared data in a new way:

Previously The time was measured, which require data, to the sensor to an object and back to the sensor flew. The new technique to determine a pattern of projected red dots on the space and measuring the size and the distance to the depth data.

In the Kinect was a 4-fold integrated microphone array, to perform effectively in large rooms speech recognition can. Microsoft was able to draw on the experience of Windows, contained in the speech recognition since Windows XP.

The development of the software

Based on the hardware first, the problem of the motion-tracking solved. The Kinect development team (Project Natal) Jamie Shotton commissioned the Microsoft Research in Cambridge with the improvement of the first motion-tracking algorithm, had the following disadvantages:

  • The players had to take at the beginning the famous T-pose for calibration
  • the camera lost the occasional user and the system had to be re-calibrated again incl T-Pose
  • it only worked with certain body types, namely with those of the conducting Microsoft developers :)
  • from the silhouette of the user had the body parts and the joints are extracted from it. The joints of the skeleton can then be generated, that uses the Kinect for the movements

The solution: It was used computer learning software and fed a movement with tons of data, u.a. aus Hollywoods Motion Capture Studios. This resulted in a decision tree, which could see the joints.

A further highlight is the American Speech Recognition, that can deal with various American accents and was created with the help of computer learning.

The Kinect is finally on 26.9.2010 published, 3 Years after the actual release date at E3 2007. In the first 60 Days, an average of 133.000 Units sold pro Tag whereby the Kinect appears before the iPhone and iPad in the Guinness Book of Records.

Read more: The technical history of the Xbox Kinect and NUI or Kinect SDK Tutorial Installation unter Windows 7

The technical history of the Xbox Kinect and NUI

See also Microsoft's technical evolution of the Kinect

Put-That-There

In the later 70s, Chris Schmandt developed at MIT's first project with language- and gesture recognition for operating graphical user interfaces called “Put-That-There”. The user had to create a magnetic dice on the wrist and a head-mounted microphone.

His scientific work on “Put-That-There” can here read.

DreamSpace

Late 90s Mark Lucente developed a user interface for IBM, which did without reference objects such as pins or gloves and recognized the gestures of the user. The project was so visionary, that it was designed as an alternative for mouse and keyboard.

Minority Report

In the Hollywood movie with Tom Cruise 2002 is seen for the first time a Kinect-like controller, which could have been considered at the time as science fiction and for us not so difficult to imagine. As scientific advisers had Steven Spielberg John Under suitcase committed by MIT. Perhaps not so coincidentally Microsoft began a year later (2003) with the development of technology Kinect.

The Minority Report showed the possibilities of the New User Interface(NUI) one of the first productions from. This makes the film a similar pioneering as the Star Trek series, The e.g.. automatically opening doors or folding phones (Captain Kirk&#8217;s Communicator) “invented”.

Of particular interest to the following excerpt from Minority Report:

  • the Kalibrieung the user interface with a T-like movement (Video 1:26)
  • the pitfalls of this technique in the wrong movement (Video 1:46)
  • the hand gestures, reminiscent already at the Kinect control at a time, was not even on the work on the development of Kinect

Read more: Microsoft's technical evolution of the Kinect or Kinect SDK Tutorial Installation unter Windows 7

from the book:

Terminal / console command from the program from start

The following function can be started console commands from a C / C program:

#include <iomanip>
#include <iostream>
#include <cstdlib>

using namespace std;

bool startExternalProgramm(char* terminalCommando)
{    
    bool returnVal = false;
    if(terminalCommando != "")
    {
        cout << "Executing terminal command: " << terminalCommando << endl;
        int systemReturn = system(terminalCommando);
        
        if (systemReturn == 0)
        {
            returnVal = true;
        }
        else
        {
            cout << "The value returned from Terminal  was: " << systemReturn << endl;
            cout << "Sorry,commando for terminal not executable" << endl; 
        }
    }
    else
    {
        cout << "Sorry, empty commando for terminal" << endl;         
    }
    return returnVal;
        
}