Base image storage class This defines the storage and pixel-wise access to a image like 3-D matrix. More...
#include <zupply.hpp>
Public Types | |
| typedef _Tp | value_type |
Public Member Functions | |
| ImageBase () | |
| ImageBase Default(empty) constructor. | |
| ImageBase (int rows, int cols, int channels) | |
| ImageBase Constructor with size info. More... | |
| ImageBase (const ImageBase &other) | |
| ImageBase Copy constructor(shallow copy) More... | |
| ImageBase (ImageBase &&other) | |
| ImageBase Move constructor. More... | |
| void | create (int rows, int cols, int channels) |
| create Create storage with specified size More... | |
| void | release () |
| release Destroy memory storage | |
| ImageBase & | operator= (const ImageBase &other) |
| operator = Copy operator, again, shallow copy More... | |
| ImageBase & | operator= (ImageBase &&other) |
| operator = Move operator More... | |
| _Tp & | operator() (int row, int col, int channel=0) |
| operator () Access pixel element More... | |
| const _Tp & | operator() (int row, int col, int channel=0) const |
| operator () Access pixel element, immutable version More... | |
| template<typename _Tp2 > | |
| operator ImageBase< _Tp2 > () const | |
| bool | empty () const |
| empty Check empty or not More... | |
| int | rows () const |
| rows Get number of rows(height, y...) More... | |
| int | cols () const |
| cols Get number of columns(width, x...) More... | |
| int | channels () const |
| channels Get number of channels More... | |
| _Tp | at (int row, int col, int channel=0) const |
| at Access pixel, immutable version. This is guanranteed to be faster than () operator if you don't need to modify data. More... | |
| _Tp * | ptr (int offset=0) const |
| ptr Data pointer given specifed position. Use with cautious. This is provided for performance consideration. Will not trigger copy-on-write method, so if you change the data, the previous copied images will be affected. More... | |
| _Tp * | ptr (int row, int col, int channel=0) const |
| ptr Data pointer given specifed position. Use with cautious. This is provided for performance consideration. Will not trigger copy-on-write method, so if you change the data, the previous copied images will be affected. More... | |
| void | import (_Tp *data, int rows, int cols, int channels) |
| import Import data from raw pointer array. Please make sure the length of array satisfies the size provided. More... | |
| void | import (std::vector< _Tp > data, int rows, int cols, int channels) |
| import Import data from vector. Please make sure the length of vector satisfies the size provided. More... | |
| std::vector< _Tp > | export_raw () const |
| template<typename _Tp2 > | |
| std::vector< _Tp2 > & | export_raw (std::vector< _Tp2 > &out) const |
| export data to provided vector container. | |
| void | crop (int r0, int c0, int r1, int c1) |
| crop Crop image given coordinates. More... | |
| void | crop (Point p0, Point p1) |
| crop Crop image given two points More... | |
| void | crop (Rect rect) |
| crop Crop image given a rectangle area. More... | |
Protected Member Functions | |
| void | range_check (long long pos) const |
| void | range_check (int row, int col, int channel) const |
| void | detach () |
Protected Attributes | |
| int | rows_ |
| int | cols_ |
| int | channels_ |
| std::shared_ptr< std::vector< _Tp > > | data_ |
Detailed Description
template<typename _Tp>
class zz::detail::ImageBase< _Tp >
Base image storage class This defines the storage and pixel-wise access to a image like 3-D matrix.
Constructor & Destructor Documentation
| zz::detail::ImageBase< _Tp >::ImageBase | ( | int | rows, |
| int | cols, | ||
| int | channels | ||
| ) |
ImageBase Constructor with size info.
- Parameters
-
rows cols channels
| zz::detail::ImageBase< _Tp >::ImageBase | ( | const ImageBase< _Tp > & | other | ) |
| zz::detail::ImageBase< _Tp >::ImageBase | ( | ImageBase< _Tp > && | other | ) |
ImageBase Move constructor.
- Parameters
-
other
Member Function Documentation
| _Tp zz::detail::ImageBase< _Tp >::at | ( | int | row, |
| int | col, | ||
| int | channel = 0 |
||
| ) | const |
at Access pixel, immutable version. This is guanranteed to be faster than () operator if you don't need to modify data.
- Parameters
-
row col channel
- Returns
- Pixel value
| int zz::detail::ImageBase< _Tp >::channels | ( | ) | const |
channels Get number of channels
- Returns
- Number of channels
| int zz::detail::ImageBase< _Tp >::cols | ( | ) | const |
cols Get number of columns(width, x...)
- Returns
- Number of columns(width, x...)
| void zz::detail::ImageBase< _Tp >::create | ( | int | rows, |
| int | cols, | ||
| int | channels | ||
| ) |
create Create storage with specified size
- Parameters
-
rows cols channels
| void zz::detail::ImageBase< _Tp >::crop | ( | int | r0, |
| int | c0, | ||
| int | r1, | ||
| int | c1 | ||
| ) |
crop Crop image given coordinates.
- Parameters
-
r0 c0 r1 c1
| void zz::detail::ImageBase< _Tp >::crop | ( | Point | p0, |
| Point | p1 | ||
| ) |
crop Crop image given two points
- Parameters
-
p0 p1
| void zz::detail::ImageBase< _Tp >::crop | ( | Rect | rect | ) |
crop Crop image given a rectangle area.
- Parameters
-
rect
| bool zz::detail::ImageBase< _Tp >::empty | ( | ) | const |
empty Check empty or not
- Returns
- True if empty
| void zz::detail::ImageBase< _Tp >::import | ( | _Tp * | data, |
| int | rows, | ||
| int | cols, | ||
| int | channels | ||
| ) |
import Import data from raw pointer array. Please make sure the length of array satisfies the size provided.
- Parameters
-
data rows cols channels
| void zz::detail::ImageBase< _Tp >::import | ( | std::vector< _Tp > | data, |
| int | rows, | ||
| int | cols, | ||
| int | channels | ||
| ) |
import Import data from vector. Please make sure the length of vector satisfies the size provided.
- Parameters
-
data rows cols channels
| zz::detail::ImageBase< _Tp >::operator ImageBase< _Tp2 > | ( | ) | const |
Conver to another data type, using saturate_cast<>
| _Tp& zz::detail::ImageBase< _Tp >::operator() | ( | int | row, |
| int | col, | ||
| int | channel = 0 |
||
| ) |
operator () Access pixel element
- Parameters
-
row col channel
- Returns
| const _Tp& zz::detail::ImageBase< _Tp >::operator() | ( | int | row, |
| int | col, | ||
| int | channel = 0 |
||
| ) | const |
operator () Access pixel element, immutable version
- Parameters
-
row col channel
- Returns
| ImageBase& zz::detail::ImageBase< _Tp >::operator= | ( | const ImageBase< _Tp > & | other | ) |
operator = Copy operator, again, shallow copy
- Parameters
-
other
- Returns
| ImageBase& zz::detail::ImageBase< _Tp >::operator= | ( | ImageBase< _Tp > && | other | ) |
operator = Move operator
- Parameters
-
other
- Returns
| _Tp* zz::detail::ImageBase< _Tp >::ptr | ( | int | offset = 0 | ) | const |
ptr Data pointer given specifed position. Use with cautious. This is provided for performance consideration. Will not trigger copy-on-write method, so if you change the data, the previous copied images will be affected.
- Parameters
-
offset
- Returns
- Raw pointer to specific data point
| _Tp* zz::detail::ImageBase< _Tp >::ptr | ( | int | row, |
| int | col, | ||
| int | channel = 0 |
||
| ) | const |
ptr Data pointer given specifed position. Use with cautious. This is provided for performance consideration. Will not trigger copy-on-write method, so if you change the data, the previous copied images will be affected.
- Parameters
-
row col channel
- Returns
| int zz::detail::ImageBase< _Tp >::rows | ( | ) | const |
rows Get number of rows(height, y...)
- Returns
- Number of rows(height, y...)
The documentation for this class was generated from the following file:
1.8.9.1