MIRA
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ImgTypedBase< TImg, TPixel > Class Template Reference

Base class for typed images. More...

#include <image/Img.h>

Inheritance diagram for ImgTypedBase< TImg, TPixel >:
Inheritance graph
[legend]

Public Types

typedef ImgIterator< TPixel > iterator
 
typedef ImgConstIterator< TPixel > const_iterator
 

Public Member Functions

TImg & operator= (const TPixel &p)
 assigns a specific type to the image data (used to set pixel values) More...
 
TPixel * operator[] (int y)
 access to image row More...
 
const TPixel * operator[] (int y) const
 const access to image row More...
 
TImg operator() (const cv::Rect &roi)
 returns a ROI out of the image Returns a new image with set ROI on the image data. More...
 
TImg operator() (const cv::Rect &roi) const
 returns a ROI out of the image Returns a new image with set ROI on the image data. More...
 
TPixel & operator() (int x, int y)
 access pixel(x,y) More...
 
const TPixel & operator() (int x, int y) const
 const access pixel(x,y) More...
 
TPixel & operator() (const cv::Point &p)
 access to pixel given by point p More...
 
const TPixel & operator() (const cv::Point &p) const
 const access to pixel given by point p More...
 
iterator begin ()
 Returns an iterator to the beginning of this image (image region) More...
 
iterator end ()
 Returns an iterator to the end of this image (image region) Note that the end iterator is NOT part of the image (image region) More...
 
const_iterator begin () const
 Returns an const iterator to the beginning of this image (image region) More...
 
const_iterator end () const
 Returns an const iterator to the end of this image (image region) Note that the end iterator is NOT part of the image (image region) More...
 
template<typename Derived >
void reflect (BinarySerializer< Derived > &r)
 reflect method for binaryStream serialization This method uses the reflect method of the ImageBase class More...
 
template<typename Derived >
void reflect (BinaryDeserializer< Derived > &r)
 reflect method for binaryStream deserialization This method uses the reflect method of the ImageBase class and assures that the type of the deserialized image is correct. More...
 
void reflect (JSONSerializer &r)
 reflect method for json serialization This method uses the reflect method of the ImageBase class More...
 
 operator const cv::Mat & () const
 cast operator to const cv::Mat More...
 
 operator cv::Mat & ()
 cast operator to cv::Mat More...
 
void assignROI (const cv::Rect &roi, const ImgBase &other)
 Copies the content of other into the specified region of interest (ROI) of THIS image. More...
 
void assignMask (const cv::Rect &roi, const ImgBase &other, const cv::Mat &mask)
 Copies the content of other into the specified region of interest (ROI) of THIS image, where mask has non-zero values. More...
 
void assignPolygon (const cv::Rect &roi, const ImgBase &other, const Polygon2i &poly)
 Copies the content of other into the specified region of interest (ROI) of THIS image, in area covered by polygon. More...
 
bool operator== (const cv::Mat &other) const
 Returns true if two images are equal. More...
 
bool operator!= (const cv::Mat &other) const
 Returns true if two images are different. More...
 
const cv::MatgetMat () const
 Returns const access to internal data. More...
 
bool empty () const
 returns true if internal Mat is empty More...
 
int width () const
 
int height () const
 
std::size_t step () const
 Number of bytes from one row to the next. More...
 
std::size_t bytesPerLine () const
 Returns the number of bytes per image line. More...
 
Size2i size () const
 Returns size of image data. More...
 
int depth () const
 Returns the bit-depth of the image E.g. More...
 
int channels () const
 Returns the number of channels of this image. More...
 
bool isEmpty () const
 returns true if internal Mat is empty More...
 
uint8 * data ()
 Returns pointer to underlying image data. More...
 
const uint8 * data () const
 Returns const pointer to underlying image data. More...
 
uint8 * data (int y)
 Returns pointer to underlying image data starting at scanline y. More...
 
const uint8 * data (int y) const
 Returns const pointer to underlying image data starting at scanline y. More...
 
ImgFormat format () const
 Return the storage format description. More...
 
void resize (const Size2i &s)
 Resizes the image to the specified dimensions (without changing its type, i.e. More...
 
void resize (int width, int height)
 Same as above method. More...
 
void clear ()
 Sets each pixel and each channel to zero. More...
 
TImg clone () const
 Deep copy of image data. More...
 
std::size_t total () const
 Returns the total size of the matrix (rows*cols) More...
 

Static Public Member Functions

static TImg convertFrom (const cv::Mat &other, bool alwaysCopy=false)
 Converts a typed image into another typed image If the channels and/or type of the new image and the source differ, the image is converted and copied using the cv::mixChannels and cvConvertScale functions. More...
 

Protected Member Functions

 ImgTypedBase (const cv::Mat &data)
 
 ImgTypedBase ()
 standard constructor More...
 
 ImgTypedBase (int width, int height)
 constructs a new image using width and height and type from Template type. More...
 
TImg * This ()
 
const TImg * This () const
 
cv::Mat_< TPixel > & castToMat ()
 operator for convenience access to image data as Mat More...
 
const cv::Mat_< TPixel > & castToMat () const
 operator for convenience const access to image data as Mat More...
 

Protected Attributes

cv::Mat mData
 

Friends

class ImgBase< TImg >
 

Detailed Description

template<typename TImg, typename TPixel>
class mira::ImgTypedBase< TImg, TPixel >

Base class for typed images.

Class providing the base functionality of typed images. You should not create instances of this class by yourself, so the constructor is protected. Please, use the typed Img<type,channels> class instead.

Member Typedef Documentation

◆ iterator

typedef ImgIterator<TPixel> iterator

◆ const_iterator

Constructor & Destructor Documentation

◆ ImgTypedBase() [1/3]

ImgTypedBase ( const cv::Mat data)
inlineprotected

◆ ImgTypedBase() [2/3]

ImgTypedBase ( )
inlineprotected

standard constructor

◆ ImgTypedBase() [3/3]

ImgTypedBase ( int  width,
int  height 
)
inlineprotected

constructs a new image using width and height and type from Template type.

note: the image data is allocated but not initialized

Member Function Documentation

◆ convertFrom()

static TImg convertFrom ( const cv::Mat other,
bool  alwaysCopy = false 
)
inlinestatic

Converts a typed image into another typed image If the channels and/or type of the new image and the source differ, the image is converted and copied using the cv::mixChannels and cvConvertScale functions.

If the channels and type equals the image is only copied if alwaysCopy is true.

Parameters
otherThe image that should be converted
alwaysCopyIf true the data is always copied even if channels and type match
Returns
the converted image

◆ operator=()

TImg& operator= ( const TPixel &  p)
inline

assigns a specific type to the image data (used to set pixel values)

◆ operator[]() [1/2]

TPixel* operator[] ( int  y)
inline

access to image row

Parameters
yrow to access. starting with 0 at top of image

◆ operator[]() [2/2]

const TPixel* operator[] ( int  y) const
inline

const access to image row

Parameters
yrow to access. starting with 0 at top of image

◆ operator()() [1/6]

TImg operator() ( const cv::Rect &  roi)
inline

returns a ROI out of the image Returns a new image with set ROI on the image data.

Note
no image data is copied, just a new header is created.

◆ operator()() [2/6]

TImg operator() ( const cv::Rect &  roi) const
inline

returns a ROI out of the image Returns a new image with set ROI on the image data.

Note
no image data is copied, just a new header is created.

◆ operator()() [3/6]

TPixel& operator() ( int  x,
int  y 
)
inline

access pixel(x,y)

◆ operator()() [4/6]

const TPixel& operator() ( int  x,
int  y 
) const
inline

const access pixel(x,y)

◆ operator()() [5/6]

TPixel& operator() ( const cv::Point &  p)
inline

access to pixel given by point p

◆ operator()() [6/6]

const TPixel& operator() ( const cv::Point &  p) const
inline

const access to pixel given by point p

◆ begin() [1/2]

iterator begin ( )
inline

Returns an iterator to the beginning of this image (image region)

See also
ImgIterator

◆ end() [1/2]

iterator end ( )
inline

Returns an iterator to the end of this image (image region) Note that the end iterator is NOT part of the image (image region)

See also
ImgIterator

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Returns an const iterator to the beginning of this image (image region)

See also
ImgConstIterator

◆ end() [2/2]

const_iterator end ( ) const
inline

Returns an const iterator to the end of this image (image region) Note that the end iterator is NOT part of the image (image region)

See also
ImgConstIterator

◆ reflect() [1/3]

void reflect ( BinarySerializer< Derived > &  r)
inline

reflect method for binaryStream serialization This method uses the reflect method of the ImageBase class

◆ reflect() [2/3]

void reflect ( BinaryDeserializer< Derived > &  r)
inline

reflect method for binaryStream deserialization This method uses the reflect method of the ImageBase class and assures that the type of the deserialized image is correct.

Otherwise an exception is thrown

◆ reflect() [3/3]

void reflect ( JSONSerializer r)
inline

reflect method for json serialization This method uses the reflect method of the ImageBase class

◆ This() [1/2]

TImg* This ( )
inlineprotected

◆ This() [2/2]

const TImg* This ( ) const
inlineprotected

◆ castToMat() [1/2]

cv::Mat_<TPixel>& castToMat ( )
inlineprotected

operator for convenience access to image data as Mat

◆ castToMat() [2/2]

const cv::Mat_<TPixel>& castToMat ( ) const
inlineprotected

operator for convenience const access to image data as Mat

◆ operator const cv::Mat &()

operator const cv::Mat & ( ) const
inlineinherited

cast operator to const cv::Mat

◆ operator cv::Mat &()

operator cv::Mat & ( )
inlineinherited

cast operator to cv::Mat

◆ assignROI()

void assignROI ( const cv::Rect &  roi,
const ImgBase< TImg > &  other 
)
inlineinherited

Copies the content of other into the specified region of interest (ROI) of THIS image.

Note, the number of rows and columns of "other" and "this" ROI must be equal.

◆ assignMask()

void assignMask ( const cv::Rect &  roi,
const ImgBase< TImg > &  other,
const cv::Mat mask 
)
inlineinherited

Copies the content of other into the specified region of interest (ROI) of THIS image, where mask has non-zero values.

Note, the number of rows and columns of "other", "mask" and "this" ROI must be equal.

◆ assignPolygon()

void assignPolygon ( const cv::Rect &  roi,
const ImgBase< TImg > &  other,
const Polygon2i poly 
)
inlineinherited

Copies the content of other into the specified region of interest (ROI) of THIS image, in area covered by polygon.

The result does not depend on cw/ccw order of polygon points. Note, the number of rows and columns of "other" and "this" ROI must be equal. Polygon points are relative to roi, any polygon points outside roi are ignored! (i.e.they must be >= 0, < roi width/height)!

◆ operator==()

bool operator== ( const cv::Mat other) const
inlineinherited

Returns true if two images are equal.

this methods checks if two images are equal by comparing their dimensions, flags and pixel data (byte wise)

◆ operator!=()

bool operator!= ( const cv::Mat other) const
inlineinherited

Returns true if two images are different.

See operator==

◆ getMat()

const cv::Mat& getMat ( ) const
inlineinherited

Returns const access to internal data.

◆ empty()

bool empty ( ) const
inlineinherited

returns true if internal Mat is empty

◆ width()

int width ( ) const
inlineinherited

◆ height()

int height ( ) const
inlineinherited

◆ step()

std::size_t step ( ) const
inlineinherited

Number of bytes from one row to the next.

◆ bytesPerLine()

std::size_t bytesPerLine ( ) const
inlineinherited

Returns the number of bytes per image line.

◆ size()

Size2i size ( ) const
inlineinherited

Returns size of image data.

◆ depth()

int depth ( ) const
inlineinherited

Returns the bit-depth of the image E.g.

CV_8U, CV_8S, CV_16U, CV_16S, CV_32S, CV_32F, CV_64F

Returns
bit-depth of image

◆ channels()

int channels ( ) const
inlineinherited

Returns the number of channels of this image.

Note: typed images also have a static enum value 'Channels'

Returns
Number of image channels

◆ isEmpty()

bool isEmpty ( ) const
inlineinherited

returns true if internal Mat is empty

◆ data() [1/4]

uint8* data ( )
inlineinherited

Returns pointer to underlying image data.

◆ data() [2/4]

const uint8* data ( ) const
inlineinherited

Returns const pointer to underlying image data.

◆ data() [3/4]

uint8* data ( int  y)
inlineinherited

Returns pointer to underlying image data starting at scanline y.

◆ data() [4/4]

const uint8* data ( int  y) const
inlineinherited

Returns const pointer to underlying image data starting at scanline y.

◆ format()

ImgFormat format ( ) const
inlineinherited

Return the storage format description.

◆ resize() [1/2]

void resize ( const Size2i s)
inlineinherited

Resizes the image to the specified dimensions (without changing its type, i.e.

channels and bit depth remains constant). The method does nothing, if the specified dimensions equal the current size of the image.

◆ resize() [2/2]

void resize ( int  width,
int  height 
)
inlineinherited

Same as above method.

◆ clear()

void clear ( )
inlineinherited

Sets each pixel and each channel to zero.

◆ clone()

TImg clone ( ) const
inlineinherited

Deep copy of image data.

◆ total()

std::size_t total ( ) const
inlineinherited

Returns the total size of the matrix (rows*cols)

Friends And Related Function Documentation

◆ ImgBase< TImg >

friend class ImgBase< TImg >
friend

Member Data Documentation

◆ mData

cv::Mat mData
protectedinherited

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