Auxilliary Tool:
A data structure that represents an image in an efficient memory layout, and manipulates that image in ways useful for efficient feature processing.
More...
#include <ImagePatch.h>
Public Member Functions | |
ImagePatch () | |
Constructor. | |
~ImagePatch () | |
Destructor. | |
ImagePatch (const ImagePatch ©) | |
Copy Constructor. | |
ImagePatch & | operator= (const ImagePatch &rhs) |
Assignment operator. | |
void | setImage (const cv::Mat &image, int setData=1, int setIntegral=1) |
Sets the ImagePatch to contain this image's data. | |
void | setImage (const cv::Mat &image, cv::Rect ROI, int setData=1, int setIntegral=1) |
Sets the ImagePatch to contain this image's data contained in ROI. | |
cv::Size | getImageSize () const |
Get the size of the ImagePatch. | |
void | getImageHeader (cv::Mat &header) const |
Get an OpenCV image of this image patch's actual data, without copying. You are responsible for releasing this Image Header. Don't release the image! | |
const integral_type * | startOfIntegralData () const |
Get a pointer to the integral image data. This data is laid out row-wise. Each row has length integralDataRowWidth(). Elements after the getImageSize().width+1st have unspecified value. | |
const unsigned char * | startOfImageData () const |
Get a pointer to the raw image data. This data is laid out row-wise. Each row has length integralDataRowWidth(). Elements after the getImageSize().width th have unspecified value. | |
int | imageDataRowWidth () const |
Number of unsigned chars from the start of one row of the raw image data to the start of the next. At least getImageSize().width. | |
int | imageDataRowBytes () const |
Number of bytes from the start of one row of the raw image data to the start of the next. | |
int | integralDataRowWidth () const |
Number of integral_type values from the start of one row of raw image data to the start of the next. At least getImageSize().width+1. | |
int | integralDataRowBytes () const |
Number of bytes from the start of one row of the integral image data to the start of the next. | |
void | addToStreamBinary (std::ostream &out) |
Save a collection of image patches to a file in a verbose text-based format. | |
void | readFromStreamBinary (std::istream &in) |
Load a collection of image patches to a file in a compact binary format. | |
cv::Size | getIntegralSize () const |
Get size of integral image. | |
Static Public Member Functions | |
static void | writePatchesToFile (const char *filename, const std::vector< ImagePatch * > &patches) |
Save a collection of image patches to a file in a compact binary format. | |
static std::vector< ImagePatch * > | readPatchesFromFile (const char *filename) |
Load a collection of image patches to a file in a compact binary format. | |
Friends | |
std::istream & | operator>> (std::istream &ifs, ImagePatch *model) |
Load a single image patch from a file in a verbose text-based format. | |
std::istream & | operator>> (std::istream &ifs, std::vector< ImagePatch * > &model) |
Load a collection of image patches from a file in a verbose text-based format. | |
std::ostream & | operator<< (std::ostream &ofs, ImagePatch *model) |
Save a single image patch to a file in a verbose text-based format. | |
std::ostream & | operator<< (std::ostream &ofs, std::vector< ImagePatch * > &model) |
Save a collection of image patches to a file in a verbose text-based format. |
Auxilliary Tool:
A data structure that represents an image in an efficient memory layout, and manipulates that image in ways useful for efficient feature processing.
ImagePatch::ImagePatch | ( | ) |
Constructor.
Creates an empty image patch, which can be set later using setImage.
void ImagePatch::setImage | ( | const cv::Mat & | image, |
cv::Rect | ROI, | ||
int | setData = 1 , |
||
int | setIntegral = 1 |
||
) |
Sets the ImagePatch to contain this image's data contained in ROI.
Any converting, and resizing must be done prior to calling setImage. The image must be of type IPL_DEPTH_8U (8-bit, unsigned integer), with a single channel.
image | The image we want to represent. |
ROI | The region of the image we want to represent. |
setData | Copy the image data. This takes some memory, and is often not needed if we are only using integral based features. However, it is necessary for visualization of ImagePatch data, and may be useful for other feature types. |
setIntegral | Compute the integral of the ImagePatch. This is required to apply BoxFeature to the ImagePatch. |
void ImagePatch::setImage | ( | const cv::Mat & | image, |
int | setData = 1 , |
||
int | setIntegral = 1 |
||
) |
Sets the ImagePatch to contain this image's data.
Copies the whole image, so any cropping, converting, and resizing must be done prior to calling setImage. The image must be of type IPL_DEPTH_8U (8-bit, unsigned integer), with a single channel.
image | The image we want to represent. |
setData | Copy the image data. This takes some memory, and is often not needed if we are only using integral based features. However, it is necessary for visualization of ImagePatch data, and may be useful for other feature types. |
setIntegral | Compute the integral of the ImagePatch. This is required to apply BoxFeature to the ImagePatch. |