Apollo 11.0
自动驾驶开放平台
apollo::perception::lidar::Image< T > 模板类 参考

#include <image.h>

apollo::perception::lidar::Image< T > 的协作图:

Public 成员函数

 Image (const int width, const int height, const bool init=true)
 
 ~Image ()
 
void init (const T &val)
 Init an image
 
Image< T > * copy () const
 Copy an image
 
int width () const
 Get the width of an image
 
int height () const
 Get the height of an image
 

Public 属性

T * _data
 
T ** _access
 

详细描述

template<class T>
class apollo::perception::lidar::Image< T >

在文件 image.h40 行定义.

构造及析构函数说明

◆ Image()

template<class T >
apollo::perception::lidar::Image< T >::Image ( const int  width,
const int  height,
const bool  init = true 
)

在文件 image.h92 行定义.

92 {
93 _w = width;
94 _h = height;
95 _data = new T[_w * _h]; // allocate space for image data
96 _access = new T *[_h]; // allocate space for row pointers
97
98 // initialize row pointers
99 for (int i = 0; i < _h; i++) {
100 _access[i] = _data + (i * _w);
101 }
102
103 if (init) {
104 memset(_data, 0, _w * _h * sizeof(T));
105 }
106}
int height() const
Get the height of an image
Definition image.h:73
void init(const T &val)
Init an image
Definition image.h:113
int width() const
Get the width of an image
Definition image.h:64

◆ ~Image()

template<class T >
apollo::perception::lidar::Image< T >::~Image ( )

在文件 image.h108 行定义.

108 {
109 delete[] _data;
110 delete[] _access;
111}

成员函数说明

◆ copy()

template<class T >
Image< T > * apollo::perception::lidar::Image< T >::copy ( ) const

Copy an image

返回
Image<T>*

在文件 image.h121 行定义.

121 {
122 Image<T> *im = new Image<T>(_w, _h, false);
123 memcpy(im->_data, _data, _w * _h * sizeof(T));
124 return im;
125}

◆ height()

template<class T >
int apollo::perception::lidar::Image< T >::height ( ) const
inline

Get the height of an image

返回
int

在文件 image.h73 行定义.

73 {
74 return _h;
75 }

◆ init()

template<class T >
void apollo::perception::lidar::Image< T >::init ( const T &  val)

Init an image

在文件 image.h113 行定义.

113 {
114 T *ptr = imPtr(this, 0, 0);
115 T *end = imPtr(this, _w - 1, _h - 1);
116 while (ptr <= end) {
117 *ptr++ = val;
118 }
119}
#define imPtr(im, x, y)
Definition image.h:90

◆ width()

template<class T >
int apollo::perception::lidar::Image< T >::width ( ) const
inline

Get the width of an image

返回
int

在文件 image.h64 行定义.

64 {
65 return _w;
66 }

类成员变量说明

◆ _access

template<class T >
T** apollo::perception::lidar::Image< T >::_access

在文件 image.h81 行定义.

◆ _data

template<class T >
T* apollo::perception::lidar::Image< T >::_data

在文件 image.h78 行定义.


该类的文档由以下文件生成: