Jafar
|
#include <Image.hpp>
Public Member Functions | |
Image (int width, int height, int depth, JfrImage_TypeColorSpace colorSpace) | |
Construct a new Image. | |
Image (Image const &img) | |
copy constructor from Image | |
Image & | operator= (Image const &img) |
copy constructor from Image | |
Image & | operator= (const cv::Mat &matrix) |
copy constructor from cv::Mat affects only the data, the header is kept | |
Image (const CvImage &img) | |
Override copy constructor of CvImage. | |
Image (IplImage *img) | |
Override constructor from IplImage. | |
Image (const cv::Mat &matrix) | |
Override constructor from cv::Mat. | |
Image (const Image &img, const cv::Rect &roi) | |
copy constructor with relative ROI, without reallocation | |
Image | clone () const |
clone Image (ie copy data) | |
void | copyTo (image::Image &dst, const image::Image &mask=image::Image()) const |
Copies an image into another applying a mask. | |
void | create (int width, int height, int depth, JfrImage_TypeColorSpace colorSpace) |
bool | load (const std::string &filename, int iscolor=-1) |
Load an image. | |
void | save (const std::string &filename) const |
OpenCV save function. | |
void | save (const std::string &filename, const std::string &imgname) |
void | save (const std::string &filename, const std::vector< int > ¶ms) |
void | print () |
void | convertColorMode (jafar::image::Image &dst_) const |
Convert Color space of a JfrImage. | |
void | convertDepth (jafar::image::Image &dst_, double scale=1.0, double offset=0.0, bool _abs=false) const |
Change the depth of the image. | |
void | resize (Image &resizedImage, int interpolation=CV_INTER_LINEAR) const |
Resize the current image in resizedImage. | |
Image * | resize (double scale, int interpolation=CV_INTER_LINEAR) const |
Resize the current image in a newly allocated image. | |
Image * | resize (int newWidth, int newHeight, int interpolation=CV_INTER_LINEAR) const |
Resize the current image in a newly allocated image. | |
void | resize (int newWidth, int newHeight, int interpolation=CV_INTER_LINEAR) |
In-place resize of the current image. | |
int | imageSize () const |
JfrImage_TypeColorSpace | colorSpace () const |
void | setColorSpace (JfrImage_TypeColorSpace cs) |
uchar * | data (int line=0) |
const uchar * | data (int line=0) const |
void | copy (jafar::image::Image &dst, int x_src=0, int y_src=0, int x_dst=0, int y_dst=0, int width=-1, int height=-1) const |
Copy the image in the destination. | |
bool | robustCopy (jafar::image::Image &dst, int x_src=0, int y_src=0, int x_dst=0, int y_dst=0, int width=-1, int height=-1) const |
Same as copy, but deals correctly with parts outside of images (fills black in dst) | |
bool | extractPatch (image::Image &dst, int x, int y, int width, int height) const |
cv::Rect | getROI () const |
Get the absolute Region Of Interest of the image. | |
cv::Rect | getROI (cv::Size &size) const |
Get the absolute Region Of Interest and full size of the image. | |
void | setROI (const cv::Rect &rect) |
Set the absolute Region Of Interest of the image. | |
void | setROI (int x, int y, int w, int h) |
Set the absolute Region Of Interest of the image. | |
void | resetROI () |
Reset the Region Of Interest of the image to the full image. | |
std::string | name () const |
void | setName (const std::string &_name) |
image file name. | |
template<typename channeltype > | |
channeltype | getPixelValue (int x_, int y_, int channel_=0) const |
template<typename channeltype > | |
double | getSubPixelValue (double x_, double y_, int channel_=0, JfrImage_InterpolationType _interpolation=JfrImage_INTERP_BILINEAR) const |
This function return the subvalue of a pixel with linear interpolation. | |
template<typename channeltype > | |
void | setPixelValue (channeltype val_, int x_, int y_, int channel_=0) |
Set the value of a pixel. | |
double | computeZncc (Image const *im2) const |
This function compute the ZNCC between two images of the same depth and size. | |
double | computeZnccRoisWeight (Image const *im2, cv::Rect const *roi1_=NULL, cv::Rect const *roi2_=NULL, float const *weightMatrix=NULL) const |
This function computes the ZNCC between two images of the same depth in two regions of interest that must have the same size, and can apply a spatially distributed weight. | |
double | computeZnccRoi (Image const *im2, cv::Rect const *rectRoi) const |
This function computes the ZNCC between two images of the same depth in the given region of interest only. | |
double | computeRotatingZncc (Image const *im2, int rotationStep) const |
This function return the best ZNCC between two images, the second images get rotated. | |
Image * | rankTransform (const int radius) |
Apply rank transform in a newly allocated image. | |
void | rotateScale (double angle, double factor, Image &dest) const |
This function rotates and scales the image. | |
double | orientation (double sigma=1.5) |
bool | compHeader (Image const &img) const |
operator cv::Mat & () | |
convert to cv::Mat reference | |
operator const cv::Mat & () const | |
convert to const cv::Mat reference | |
operator const IplImage () const | |
convert to const IplImage | |
operator IplImage () | |
convert to IplImage | |
operator const CvMat () const | |
convert to const CvMat | |
operator CvMat () | |
convert to CvMat | |
cv::Size | size () const |
bool | empty () const |
int | width () const |
int | height () const |
size_t | step () const |
size_t | step1 () const |
int | depth () const |
int | channels () const |
int | type () const |
cv::Mat | mat () const |
void | detach () |
detaches image | |
size_t | pix_size () |
pixel size | |
void | setTo (const cv::Scalar &s, const image::Image &mask=image::Image()) |
set the matrix elements to the given value | |
void | convertTo (image::Image &dst, double alpha=1, double beta=0) const |
convert image to another one, it is a wrapping to cv::Mat::converTo | |
Static Public Member Functions | |
static Image * | loadImage (const char *filename, int iscolor=-1) |
Allocate and load an image. | |
Private Member Functions | |
void | initImageHeader () |
template<class Archive > | |
void | save (Archive &ar, const unsigned int version) const |
template<class Archive > | |
void | load (Archive &ar, const unsigned int version) |
double | cubicKernel (int t, double dt) const |
Call as t - dt . | |
double | cubicKernelI (int t, int idx) const |
Private Attributes | |
cv::Mat | m_matrix |
OpenCV matrix that holds image data. | |
JfrImage_ImageHeader | header |
std::string | m_name |
Static Private Attributes | |
static const int | cubicKernelResolution = 255 |
static const double | cubicKernel1 [256] |
static const double | cubicKernel2 [256] |
Friends | |
class | boost::serialization::access |
jafar::image::Image::Image | ( | int | width, |
int | height, | ||
int | depth, | ||
JfrImage_TypeColorSpace | colorSpace | ||
) |
Construct a new Image.
width | the image width |
height | the image height |
depth | the image depth |
colorSpace | the color space of the image |
jafar::image::Image::Image | ( | const Image & | img, |
const cv::Rect & | roi | ||
) |
int jafar::image::Image::channels | ( | ) | const [inline] |
Definition at line 478 of file Image.hpp.
References m_matrix.
Referenced by getPixelValue(), getSubPixelValue(), setPixelValue(), jafar::camera::univReprojectionCylindric(), and jafar::camera::univReprojectionPerspective().
JfrImage_TypeColorSpace jafar::image::Image::colorSpace | ( | ) | const [inline] |
Definition at line 221 of file Image.hpp.
Referenced by compHeader(), jafar::image::extractPatch(), jafar::hpm::TrackingEngine::initTracking(), and jafar::hpm::TrackingEngine::track().
bool jafar::image::Image::compHeader | ( | Image const & | img | ) | const [inline] |
double jafar::image::Image::computeRotatingZncc | ( | Image const * | im2, |
int | rotationStep | ||
) | const |
This function return the best ZNCC between two images, the second images get rotated.
im2 | the second image |
rotationStep | the step used for the applied rotation |
double jafar::image::Image::computeZncc | ( | Image const * | im2 | ) | const |
This function compute the ZNCC between two images of the same depth and size.
im2 | the second image |
double jafar::image::Image::computeZnccRoi | ( | Image const * | im2, |
cv::Rect const * | rectRoi | ||
) | const |
This function computes the ZNCC between two images of the same depth in the given region of interest only.
im2 | the second image |
rectRoi | defines the roi |
double jafar::image::Image::computeZnccRoisWeight | ( | Image const * | im2, |
cv::Rect const * | roi1_ = NULL , |
||
cv::Rect const * | roi2_ = NULL , |
||
float const * | weightMatrix = NULL |
||
) | const |
This function computes the ZNCC between two images of the same depth in two regions of interest that must have the same size, and can apply a spatially distributed weight.
It ignores pixels with extremum value (eg 0 and 255 for char), and ignores parts outside of images, but requires at least half of pixels not ignored to return non 0.
im2 | the second image |
roi1_ | the region of interest in this image |
roi2_ | the region of interest in the second image (that must have the same size than roi1_) |
weightMatrix | the weight matrix that must have the same size than the regions of interest |
void jafar::image::Image::convertColorMode | ( | jafar::image::Image & | dst_ | ) | const |
Convert Color space of a JfrImage.
dst_ | destination image |
colorCode_ | type of conversion. |
void jafar::image::Image::convertDepth | ( | jafar::image::Image & | dst_, |
double | scale = 1.0 , |
||
double | offset = 0.0 , |
||
bool | _abs = false |
||
) | const |
Change the depth of the image.
void jafar::image::Image::copy | ( | jafar::image::Image & | dst, |
int | x_src = 0 , |
||
int | y_src = 0 , |
||
int | x_dst = 0 , |
||
int | y_dst = 0 , |
||
int | width = -1 , |
||
int | height = -1 |
||
) | const |
Copy the image in the destination.
dst | destination |
x_src | x coordinate in the source |
y_src | y coordinate in the source |
x_dst | x coordinate in the destination |
y_dst | y coordinate in the destination |
Referenced by jafar::image::extractPatch().
void jafar::image::Image::create | ( | int | width, |
int | height, | ||
int | depth, | ||
JfrImage_TypeColorSpace | colorSpace | ||
) |
create data (check if allocation or reallocation is needed)
width | the image width |
height | the image height |
depth | the image depth |
colorSpace | the color space of the image |
double jafar::image::Image::cubicKernel | ( | int | t, |
double | dt | ||
) | const [inline, private] |
uchar* jafar::image::Image::data | ( | int | line = 0 | ) | [inline] |
line | the line number |
Definition at line 229 of file Image.hpp.
References m_matrix.
Referenced by getPixelValue(), getSubPixelValue(), jafar::quasidense::imgDataCensus::imgDataCensus(), jafar::quasidense::imgDataRank::imgDataRank(), jafar::quasidense::omniDataCensus::omniDataCensus(), jafar::quasidense::rotDataCensus::rotDataCensus(), and setPixelValue().
const uchar* jafar::image::Image::data | ( | int | line = 0 | ) | const [inline] |
int jafar::image::Image::depth | ( | ) | const [inline] |
Definition at line 476 of file Image.hpp.
References m_matrix.
Referenced by compHeader(), jafar::correl::FastZncc::compute(), jafar::correl::FastZncc::computeChar(), jafar::image::extractPatch(), jafar::quasidense::imgDataCensus::imgDataCensus(), jafar::quasidense::imgDataRank::imgDataRank(), jafar::quasidense::imgDataZncc::imgDataZncc(), jafar::quasidense::omniDataCensus::omniDataCensus(), and jafar::quasidense::rotDataCensus::rotDataCensus().
bool jafar::image::Image::empty | ( | ) | const [inline] |
channeltype jafar::image::Image::getPixelValue | ( | int | x_, |
int | y_, | ||
int | channel_ = 0 |
||
) | const [inline] |
channeltype | the channeltype of the image |
x_ | x-coord of the pixel |
y_ | y-coord of the pixel |
channel_ | required channel (default 0) |
Definition at line 561 of file Image.hpp.
References channels(), data(), height(), JFR_PRECOND, and width().
Referenced by jafar::quasidense::imgDataZncc::imgDataZncc(), jafar::camera::univReprojectionCylindric(), and jafar::camera::univReprojectionPerspective().
cv::Rect jafar::image::Image::getROI | ( | ) | const [inline] |
Get the absolute Region Of Interest of the image.
Definition at line 269 of file Image.hpp.
References size().
Referenced by jafar::correl::Explorer< Correl >::exploreTranslation().
cv::Rect jafar::image::Image::getROI | ( | cv::Size & | size | ) | const [inline] |
double jafar::image::Image::getSubPixelValue | ( | double | x_, |
double | y_, | ||
int | channel_ = 0 , |
||
JfrImage_InterpolationType | _interpolation = JfrImage_INTERP_BILINEAR |
||
) | const |
This function return the subvalue of a pixel with linear interpolation.
channeltype | the channeltype of the image |
x_ | x-coord of the subpixel |
y_ | y-coord of the subpixel |
channel_ | required channel (default 0) |
Definition at line 591 of file Image.hpp.
References channels(), data(), height(), JFR_PRECOND, and width().
Referenced by jafar::quasidense::omniDataCensus::omniDataCensus(), jafar::camera::univReprojectionCylindric(), and jafar::camera::univReprojectionPerspective().
int jafar::image::Image::height | ( | ) | const [inline] |
Definition at line 470 of file Image.hpp.
References m_matrix.
Referenced by compHeader(), jafar::correl::Explorer< Correl >::exploreTranslation(), jafar::image::extractPatch(), getPixelValue(), getSubPixelValue(), jafar::quasidense::imgDataCensus::imgDataCensus(), jafar::quasidense::imgDataRank::imgDataRank(), jafar::quasidense::imgDataZncc::imgDataZncc(), jafar::quasidense::omniDataCensus::omniDataCensus(), jafar::camera::pixelCyl2pixelPano(), jafar::sas::CV_IRT_BlobDetector::Process(), jafar::quasidense::rotDataCensus::rotDataCensus(), setPixelValue(), jafar::camera::univReprojectionCylindric(), and jafar::camera::univReprojectionPerspective().
int jafar::image::Image::imageSize | ( | ) | const |
bool jafar::image::Image::load | ( | const std::string & | filename, |
int | iscolor = -1 |
||
) |
Load an image.
filename | is the name of file to be loaded |
iscolor | specifies colorness of the loaded image: if >0, the loaded image is forced to be color 3-channel image; if 0, the loaded image is forced to be grayscale; if <0, the loaded image will be loaded as is (with number of channels depends on the file). |
Currently the following file formats are supported: Windows bitmaps - BMP, DIB; JPEG files - JPEG, JPG, JPE; JPEG 2000 files - JP2 Portable Network Graphics - PNG; Portable image format - PBM, PGM, PPM; Sun rasters - SR, RAS; TIFF files - TIFF, TIF.
static Image* jafar::image::Image::loadImage | ( | const char * | filename, |
int | iscolor = -1 |
||
) | [static] |
Allocate and load an image.
filename | is the name of file to be loaded |
iscolor | specifies colorness of the loaded image: if >0, the loaded image is forced to be color 3-channel image; if 0, the loaded image is forced to be grayscale; if <0, the loaded image will be loaded as is (with number of channels depends on the file). |
Currently the following file formats are supported: Windows bitmaps - BMP, DIB; JPEG files - JPEG, JPG, JPE; JPEG 2000 files - JP2 Portable Network Graphics - PNG; Portable image format - PBM, PGM, PPM; Sun rasters - SR, RAS; TIFF files - TIFF, TIF.
cv::Mat jafar::image::Image::mat | ( | ) | const [inline] |
std::string jafar::image::Image::name | ( | ) | const [inline] |
double jafar::image::Image::orientation | ( | double | sigma = 1.5 | ) |
Image* jafar::image::Image::rankTransform | ( | const int | radius | ) |
Apply rank transform in a newly allocated image.
radius | radius of the window used to compute rank |
Referenced by jafar::quasidense::imgDataRank::imgDataRank().
Image* jafar::image::Image::resize | ( | double | scale, |
int | interpolation = CV_INTER_LINEAR |
||
) | const |
Resize the current image in a newly allocated image.
scale | scale factor |
interpolation | interpolation mode |
Image* jafar::image::Image::resize | ( | int | newWidth, |
int | newHeight, | ||
int | interpolation = CV_INTER_LINEAR |
||
) | const |
Resize the current image in a newly allocated image.
width | new width |
height | new height |
interpolation | interpolation mode |
void jafar::image::Image::resize | ( | int | newWidth, |
int | newHeight, | ||
int | interpolation = CV_INTER_LINEAR |
||
) |
In-place resize of the current image.
width | new width |
height | new height |
interpolation | interpolation mode |
bool jafar::image::Image::robustCopy | ( | jafar::image::Image & | dst, |
int | x_src = 0 , |
||
int | y_src = 0 , |
||
int | x_dst = 0 , |
||
int | y_dst = 0 , |
||
int | width = -1 , |
||
int | height = -1 |
||
) | const |
Same as copy, but deals correctly with parts outside of images (fills black in dst)
void jafar::image::Image::rotateScale | ( | double | angle, |
double | factor, | ||
Image & | dest | ||
) | const |
This function rotates and scales the image.
angle | the rotation angle (degrees) |
factor | the scaling factor |
dest | the destination image |
void jafar::image::Image::save | ( | const std::string & | filename | ) | const [inline] |
OpenCV save function.
filename | name of the file where to save the image (for instance "myimage.png" or "myimage.tiff"...) |
Definition at line 152 of file Image.hpp.
References m_matrix.
Referenced by jafar::quasidense::omniMask::omniMask().
void jafar::image::Image::save | ( | const std::string & | filename, |
const std::string & | imgname | ||
) | [inline] |
void jafar::image::Image::save | ( | const std::string & | filename, |
const std::vector< int > & | params | ||
) | [inline] |
void jafar::image::Image::setName | ( | const std::string & | _name | ) | [inline] |
void jafar::image::Image::setPixelValue | ( | channeltype | val_, |
int | x_, | ||
int | y_, | ||
int | channel_ = 0 |
||
) |
Set the value of a pixel.
channeltype | the channeltype of the image |
val_ | the new value |
x_ | x-coord of the pixel |
y_ | y-coord of the pixel |
channel_ | required channel (default 0) |
Definition at line 661 of file Image.hpp.
References channels(), data(), height(), JFR_PRECOND, and width().
Referenced by jafar::quasidense::omniMask::omniMask(), jafar::camera::univReprojectionCylindric(), and jafar::camera::univReprojectionPerspective().
void jafar::image::Image::setROI | ( | const cv::Rect & | rect | ) | [inline] |
cv::Size jafar::image::Image::size | ( | ) | const [inline] |
Definition at line 464 of file Image.hpp.
References m_matrix.
Referenced by getROI(), jafar::gfm_v2::CamShiftTracker::nextImage(), resetROI(), setROI(), jafar::camera::univReprojectionCylindric(), and jafar::camera::univReprojectionPerspective().
size_t jafar::image::Image::step | ( | ) | const [inline] |
Definition at line 472 of file Image.hpp.
References m_matrix.
Referenced by jafar::quasidense::imgDataCensus::imgDataCensus(), and jafar::quasidense::imgDataRank::imgDataRank().
size_t jafar::image::Image::step1 | ( | ) | const [inline] |
int jafar::image::Image::type | ( | ) | const [inline] |
Definition at line 480 of file Image.hpp.
References m_matrix.
Referenced by convertTo(), jafar::camera::univReprojectionCylindric(), and jafar::camera::univReprojectionPerspective().
int jafar::image::Image::width | ( | ) | const [inline] |
Definition at line 468 of file Image.hpp.
References m_matrix.
Referenced by compHeader(), jafar::correl::Explorer< Correl >::exploreTranslation(), jafar::image::extractPatch(), getPixelValue(), getSubPixelValue(), jafar::quasidense::imgDataCensus::imgDataCensus(), jafar::quasidense::imgDataRank::imgDataRank(), jafar::quasidense::imgDataZncc::imgDataZncc(), jafar::quasidense::omniDataCensus::omniDataCensus(), jafar::camera::pixelCyl2pixelPano(), jafar::sas::CV_IRT_BlobDetector::Process(), jafar::quasidense::rotDataCensus::rotDataCensus(), setPixelValue(), jafar::camera::univReprojectionCylindric(), and jafar::camera::univReprojectionPerspective().
Generated on Wed Oct 15 2014 00:37:39 for Jafar by doxygen 1.7.6.1 |