Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes | Friends | List of all members
Leap::Image Class Reference

#include <Leap.h>

Inheritance diagram for Leap::Image:
Inheritance graph
[legend]

Public Types

enum  FormatType { INFRARED = 0 }
 

Public Member Functions

def __eq__ (self, arg2)
 
def __init__ (self)
 
def __ne__ (self, arg2)
 
def __str__ (self)
 
LEAP_EXPORT int bytesPerPixel () const
 
def data (self, dst)
 
def data (self)
 
LEAP_EXPORT const unsigned char * data () const
 
void data (unsigned char *dst) const
 
void * dataPointer () const
 
def distortion (self, dst)
 
def distortion (self)
 
LEAP_EXPORT const float * distortion () const
 
void distortion (float *dst) const
 
LEAP_EXPORT int distortionHeight () const
 
void * distortionPointer () const
 
LEAP_EXPORT int distortionWidth () const
 
LEAP_EXPORT FormatType format () const
 
LEAP_EXPORT int height () const
 
LEAP_EXPORT int32_t id () const
 
 Image (ImageImplementation *)
 
LEAP_EXPORT Image ()
 
LEAP_EXPORT bool isValid () const
 
LEAP_EXPORT bool operator!= (const Image &) const
 
LEAP_EXPORT bool operator== (const Image &) const
 
LEAP_EXPORT float rayOffsetX () const
 
LEAP_EXPORT float rayOffsetY () const
 
LEAP_EXPORT float rayScaleX () const
 
LEAP_EXPORT float rayScaleY () const
 
def rectify (self, uv)
 
LEAP_EXPORT Vector rectify (const Vector &uv) const
 
LEAP_EXPORT int64_t sequenceId () const
 
LEAP_EXPORT int64_t timestamp () const
 
std::string toString () const
 
def warp (self, xy)
 
LEAP_EXPORT Vector warp (const Vector &xy) const
 
LEAP_EXPORT int width () const
 
- Public Member Functions inherited from Leap::Interface
def __init__ (self, args, kwargs)
 

Static Public Member Functions

static LEAP_EXPORT const Imageinvalid ()
 

Public Attributes

 this
 

Static Public Attributes

 bytes_per_pixel = _swig_property(LeapPython.Image_bytes_per_pixel_get)
 
 data
 
 data_pointer = _swig_property(LeapPython.Image_data_pointer_get)
 
 distortion
 
 distortion_height = _swig_property(LeapPython.Image_distortion_height_get)
 
 distortion_pointer = _swig_property(LeapPython.Image_distortion_pointer_get)
 
 distortion_width = _swig_property(LeapPython.Image_distortion_width_get)
 
 format = _swig_property(LeapPython.Image_format_get)
 
 height = _swig_property(LeapPython.Image_height_get)
 
 id = _swig_property(LeapPython.Image_id_get)
 
 INFRARED = LeapPython.Image_INFRARED
 
 is_valid = _swig_property(LeapPython.Image_is_valid_get)
 
 ray_offset_x = _swig_property(LeapPython.Image_ray_offset_x_get)
 
 ray_offset_y = _swig_property(LeapPython.Image_ray_offset_y_get)
 
 ray_scale_x = _swig_property(LeapPython.Image_ray_scale_x_get)
 
 ray_scale_y = _swig_property(LeapPython.Image_ray_scale_y_get)
 
 sequence_id = _swig_property(LeapPython.Image_sequence_id_get)
 
 timestamp = _swig_property(LeapPython.Image_timestamp_get)
 
 width = _swig_property(LeapPython.Image_width_get)
 

Private Member Functions

LEAP_EXPORT const char * toCString () const
 

Static Private Attributes

 __getattr__ = lambdaself,name:_swig_getattr(self, Image, name)
 
 __repr__ = _swig_repr
 
 __setattr__ = lambdaself,name,value:_swig_setattr(self, Image, name, value)
 
 __swig_destroy__ = LeapPython.delete_Image
 
dictionary __swig_getmethods__ = {}
 
dictionary __swig_setmethods__ = {}
 

Friends

LEAP_EXPORT friend std::ostream & operator<< (std::ostream &, const Image &)
 

Additional Inherited Members

- Protected Member Functions inherited from Leap::Interface
template<typename T >
T * get () const
 
LEAP_EXPORT Interface (void *owner)
 
LEAP_EXPORT Interface (Implementation *reference, void *owner)
 
LEAP_EXPORT Interface (const Interface &rhs)
 
 Interface (class SharedObject *object)
 
LEAP_EXPORT Interfaceoperator= (const Interface &rhs)
 
virtual LEAP_EXPORT ~Interface ()
 
- Static Protected Member Functions inherited from Leap::Interface
static LEAP_EXPORT void deleteCString (const char *cstr)
 
- Protected Attributes inherited from Leap::Interface
class SharedObject * m_object
 

Detailed Description

The Image class represents a single image from one of the Leap Motion cameras.

In addition to image data, the Image object provides a distortion map for correcting lens distortion.

Note that Image objects can be invalid, which means that they do not contain valid image data. Get valid Image objects from Frame::frames(). Test for validity with the Image::isValid() function.

Since
2.1.0

Definition at line 2942 of file Leap.h.

Member Enumeration Documentation

Enumerates the possible image formats.

The Image::format() function returns an item from the FormatType enumeration.

Since
2.2.0
Enumerator
INFRARED 

Definition at line 3107 of file Leap.h.

Constructor & Destructor Documentation

Leap::Image::Image ( ImageImplementation *  )
LEAP_EXPORT Leap::Image::Image ( )

Constructs a Image object.

An uninitialized image is considered invalid. Get valid Image objects from a ImageList object obtained from the Frame::images() method.

Since
2.1.0
def Leap.Image.__init__ (   self)

Definition at line 1230 of file Leap.py.

Member Function Documentation

def Leap.Image.__eq__ (   self,
  arg2 
)

Definition at line 1250 of file Leap.py.

def Leap.Image.__ne__ (   self,
  arg2 
)

Definition at line 1253 of file Leap.py.

def Leap.Image.__str__ (   self)

Definition at line 1256 of file Leap.py.

LEAP_EXPORT int Leap::Image::bytesPerPixel ( ) const

The number of bytes per pixel.

Use this value along with Image::width() and Image:::height() to calculate the size of the data buffer.

Since
2.2.0
def Leap.Image.data (   self,
  dst 
)

Definition at line 1237 of file Leap.py.

def Leap.Image.data (   self)

Definition at line 1300 of file Leap.py.

LEAP_EXPORT const unsigned char* Leap::Image::data ( ) const

The image data.

The image data is a set of 8-bit intensity values. The buffer is Image::width() * Image::height() * Image::bytesPerPixel() bytes long.

Returns
The array of unsigned char containing the sensor brightness values.
Since
2.1.0
void Leap::Image::data ( unsigned char *  dst) const
inline

Definition at line 3038 of file Leap.h.

void* Leap::Image::dataPointer ( ) const
inline

Definition at line 3059 of file Leap.h.

def Leap.Image.distortion (   self,
  dst 
)

Definition at line 1240 of file Leap.py.

def Leap.Image.distortion (   self)

Definition at line 1304 of file Leap.py.

LEAP_EXPORT const float* Leap::Image::distortion ( ) const

The distortion calibration map for this image.

The calibration map is a 64x64 grid of points. Each point is defined by a pair of 32-bit floating point values. Each point in the map represents a ray projected into the camera. The value of a grid point defines the pixel in the image data containing the brightness value produced by the light entering along the corresponding ray. By interpolating between grid data points, you can find the brightness value for any projected ray. Grid values that fall outside the range [0..1] do not correspond to a value in the image data and those points should be ignored.

The calibration map can be used to render an undistorted image as well as to find the true angle from the camera to a feature in the raw image. The distortion map itself is designed to be used with GLSL shader programs. In non-realtime contexts, it may be more convenient to use the Image::rectify() and Image::warp() functions.

If using shaders is not possible, you can use the distortion map directly. This can be faster than using the warp() function, if carefully optimized:

Distortion is caused by the lens geometry as well as imperfections in the lens and sensor window. The calibration map is created by the calibration process run for each device at the factory (and which can be rerun by the user).

Note, in a future release, there may be two distortion maps per image; one containing the horizontal values and the other containing the vertical values.

Returns
The float array containing the camera lens distortion map.
Since
2.1.0
void Leap::Image::distortion ( float *  dst) const
inline

Definition at line 3050 of file Leap.h.

LEAP_EXPORT int Leap::Image::distortionHeight ( ) const

The distortion map height.

Currently fixed at 64.

Since
2.1.0
void* Leap::Image::distortionPointer ( ) const
inline

Definition at line 3067 of file Leap.h.

LEAP_EXPORT int Leap::Image::distortionWidth ( ) const

The stride of the distortion map.

Since each point on the 64x64 element distortion map has two values in the buffer, the stride is 2 times the size of the grid. (Stride is currently fixed at 2 * 64 = 128).

Since
2.1.0
LEAP_EXPORT FormatType Leap::Image::format ( ) const

The image format.

Since
2.2.0
LEAP_EXPORT int Leap::Image::height ( ) const

The image height.

Since
2.1.0
LEAP_EXPORT int32_t Leap::Image::id ( ) const

The image ID.

Images with ID of 0 are from the left camera; those with an ID of 1 are from the right camera (with the device in its standard operating position with the green LED facing the operator).

Since
2.1.0
static LEAP_EXPORT const Image& Leap::Image::invalid ( )
static

Returns an invalid Image object.

You can use the instance returned by this function in comparisons testing whether a given Image instance is valid or invalid. (You can also use the Image::isValid() function.)

Returns
The invalid Image instance.
Since
2.1.0
LEAP_EXPORT bool Leap::Image::isValid ( ) const

Reports whether this Image instance contains valid data.

Returns
true, if and only if the image is valid.
Since
2.1.0
LEAP_EXPORT bool Leap::Image::operator!= ( const Image ) const

Compare Image object inequality.

Two Image objects are equal if and only if both Image objects represent the exact same Image and both Images are valid.

Since
2.1.0
LEAP_EXPORT bool Leap::Image::operator== ( const Image ) const

Compare Image object equality.

Two Image objects are equal if and only if both Image objects represent the exact same Image and both Images are valid.

Since
2.1.0
LEAP_EXPORT float Leap::Image::rayOffsetX ( ) const

The horizontal ray offset.

Used to convert between normalized coordinates in the range [0..1] and the ray slope range [-4..4].

Since
2.1.0
LEAP_EXPORT float Leap::Image::rayOffsetY ( ) const

The vertical ray offset.

Used to convert between normalized coordinates in the range [0..1] and the ray slope range [-4..4].

Since
2.1.0
LEAP_EXPORT float Leap::Image::rayScaleX ( ) const

The horizontal ray scale factor.

Used to convert between normalized coordinates in the range [0..1] and the ray slope range [-4..4].

Since
2.1.0
LEAP_EXPORT float Leap::Image::rayScaleY ( ) const

The vertical ray scale factor.

Used to convert between normalized coordinates in the range [0..1] and the ray slope range [-4..4].

Since
2.1.0
def Leap.Image.rectify (   self,
  uv 
)

Definition at line 1244 of file Leap.py.

LEAP_EXPORT Vector Leap::Image::rectify ( const Vector uv) const

Provides the corrected camera ray intercepting the specified point on the image.

Given a point on the image, rectify() corrects for camera distortion and returns the true direction from the camera to the source of that image point within the Leap Motion field of view.

This direction vector has an x and y component [x, y, 0], with the third element always zero. Note that this vector uses the 2D camera coordinate system where the x-axis parallels the longer (typically horizontal) dimension and the y-axis parallels the shorter (vertical) dimension. The camera coordinate system does not correlate to the 3D Leap Motion coordinate system.

Parameters
uvA Vector containing the position of a pixel in the image.
Returns
A Vector containing the ray direction (the z-component of the vector is always 0).
Since
2.1.0
LEAP_EXPORT int64_t Leap::Image::sequenceId ( ) const

The image sequence ID.

Since
2.2.1
LEAP_EXPORT int64_t Leap::Image::timestamp ( ) const

Returns a timestamp indicating when this frame began being captured on the device.

Since
2.2.7
LEAP_EXPORT const char* Leap::Image::toCString ( ) const
private
std::string Leap::Image::toString ( ) const
inline

A string containing a brief, human readable description of the Image object.

Returns
A description of the Image as a string.
Since
2.1.0

Definition at line 3298 of file Leap.h.

def Leap.Image.warp (   self,
  xy 
)

Definition at line 1247 of file Leap.py.

LEAP_EXPORT Vector Leap::Image::warp ( const Vector xy) const

Provides the point in the image corresponding to a ray projecting from the camera.

Given a ray projected from the camera in the specified direction, warp() corrects for camera distortion and returns the corresponding pixel coordinates in the image.

The ray direction is specified in relationship to the camera. The first vector element corresponds to the "horizontal" view angle; the second corresponds to the "vertical" view angle.

The warp() function returns pixel coordinates outside of the image bounds if you project a ray toward a point for which there is no recorded data.

warp() is typically not fast enough for realtime distortion correction. For better performance, use a shader program exectued on a GPU.

Parameters
xyA Vector containing the ray direction.
Returns
A Vector containing the pixel coordinates [x, y, 0] (with z always zero).
Since
2.1.0
LEAP_EXPORT int Leap::Image::width ( ) const

The image width.

Since
2.1.0

Friends And Related Function Documentation

LEAP_EXPORT friend std::ostream& operator<< ( std::ostream &  ,
const Image  
)
friend

Writes a brief, human readable description of the Image object.

Since
2.1.0

Member Data Documentation

Leap.Image.__getattr__ = lambdaself,name:_swig_getattr(self, Image, name)
staticprivate

Definition at line 1227 of file Leap.py.

Leap.Image.__repr__ = _swig_repr
staticprivate

Definition at line 1228 of file Leap.py.

Leap.Image.__setattr__ = lambdaself,name,value:_swig_setattr(self, Image, name, value)
staticprivate

Definition at line 1223 of file Leap.py.

Leap.Image.__swig_destroy__ = LeapPython.delete_Image
staticprivate

Definition at line 1319 of file Leap.py.

dictionary Leap.Image.__swig_getmethods__ = {}
staticprivate

Definition at line 1224 of file Leap.py.

dictionary Leap.Image.__swig_setmethods__ = {}
staticprivate

Definition at line 1220 of file Leap.py.

Leap.Image.bytes_per_pixel = _swig_property(LeapPython.Image_bytes_per_pixel_get)
static

Definition at line 1272 of file Leap.py.

Leap.Image.data
static

Definition at line 1309 of file Leap.py.

Leap.Image.data_pointer = _swig_property(LeapPython.Image_data_pointer_get)
static

Definition at line 1315 of file Leap.py.

Leap.Image.distortion
static

Definition at line 1311 of file Leap.py.

Leap.Image.distortion_height = _swig_property(LeapPython.Image_distortion_height_get)
static

Definition at line 1281 of file Leap.py.

Leap.Image.distortion_pointer = _swig_property(LeapPython.Image_distortion_pointer_get)
static

Definition at line 1318 of file Leap.py.

Leap.Image.distortion_width = _swig_property(LeapPython.Image_distortion_width_get)
static

Definition at line 1278 of file Leap.py.

Leap.Image.format = _swig_property(LeapPython.Image_format_get)
static

Definition at line 1275 of file Leap.py.

Leap.Image.height = _swig_property(LeapPython.Image_height_get)
static

Definition at line 1269 of file Leap.py.

Leap.Image.id = _swig_property(LeapPython.Image_id_get)
static

Definition at line 1263 of file Leap.py.

Leap.Image.INFRARED = LeapPython.Image_INFRARED
static

Definition at line 1242 of file Leap.py.

Leap.Image.is_valid = _swig_property(LeapPython.Image_is_valid_get)
static

Definition at line 1299 of file Leap.py.

Leap.Image.ray_offset_x = _swig_property(LeapPython.Image_ray_offset_x_get)
static

Definition at line 1284 of file Leap.py.

Leap.Image.ray_offset_y = _swig_property(LeapPython.Image_ray_offset_y_get)
static

Definition at line 1287 of file Leap.py.

Leap.Image.ray_scale_x = _swig_property(LeapPython.Image_ray_scale_x_get)
static

Definition at line 1290 of file Leap.py.

Leap.Image.ray_scale_y = _swig_property(LeapPython.Image_ray_scale_y_get)
static

Definition at line 1293 of file Leap.py.

Leap.Image.sequence_id = _swig_property(LeapPython.Image_sequence_id_get)
static

Definition at line 1260 of file Leap.py.

Leap.Image.this

Definition at line 1235 of file Leap.py.

Leap.Image.timestamp = _swig_property(LeapPython.Image_timestamp_get)
static

Definition at line 1296 of file Leap.py.

Leap.Image.width = _swig_property(LeapPython.Image_width_get)
static

Definition at line 1266 of file Leap.py.


The documentation for this class was generated from the following files:


leap_motion
Author(s): Florian Lier , Mirza Shah , Isaac IY Saito
autogenerated on Tue Jun 2 2020 03:58:01