28 #include "bias_config.h"
30 #define _USE_MATH_DEFINES
41 #include <Base/Image/ImageBase.hh>
43 #define MIP_DV_WIDTH 500
44 #define MIP_DV_HEIGHT 288
47 #define D_CONVERT 1<<2
48 #define D_CAST_CHECK 1<<3
49 #define D_MI_TOPLANAR 1<<4
50 #define D_MI_IOSTREAM 1<<5
51 #define D_MI_CONVGREY 1<<6
52 #define D_IMAGE_MINMAXCOO 1<<7
77 template<
class StorageType>
87 Image(
unsigned int width,
unsigned int height,
unsigned int channels = 1,
88 const bool interleaved =
true);
112 Init(
unsigned int Width,
unsigned int Height,
unsigned int channels = 1,
113 enum EStorageType storageType = ST_unsignedchar,
114 const bool interleaved =
true);
126 int InitWithForeignData(
unsigned int width,
unsigned int height,
127 unsigned int channels,
void* data,
128 const bool interleaved =
true,
129 const bool shouldRelease =
true);
136 inline const StorageType*
139 return (
const StorageType *) ImageData_;
147 return (StorageType *) ImageData_;
152 inline const StorageType**
155 return (
const StorageType **) ImageDataArray_;
163 return (StorageType **) ImageDataArray_;
172 PixelValue(
const unsigned int x,
const unsigned int y,
173 const unsigned short int channel = 0)
const;
181 PixelValueInterleaved(
const int x,
const int y,
const int channel = 0)
const;
194 PixelValueRefInterleaved(
const int x,
const int y,
const int channel = 0);
200 GetMinPixelValue(
unsigned short int channel = 0,
unsigned int *coo =
207 GetMaxPixelValue(
unsigned short int channel = 0,
unsigned int *coo =
221 GetMinMaxPixelValue(StorageType& min, StorageType& max,
222 unsigned short int channel = 0,
unsigned int *mincoo = NULL,
223 unsigned int *maxcoo = NULL)
const;
230 GetMeanPixelValue(StorageType mean[]);
239 GetMeanPixelValueIgnoreRange(StorageType mean[],
240 const StorageType ignoreStart = 0,
const StorageType ignoreEnd = (StorageType)0)
const;
251 GetMinMaxPixelValueIgnoreRange(StorageType& min, StorageType& max,
252 const StorageType ignoreStart = 0,
const StorageType ignoreEnd = 0,
253 const unsigned short int channel = 0)
const;
262 inline const StorageType&
263 GetPixelNearestNeighbor(
const double x,
const double y,
264 const unsigned short int channel = 0)
const;
272 inline const StorageType&
273 GetPixelNearestNeighbor(
const float x,
const float y,
274 const unsigned short int channel = 0)
const;
289 void Clear(
const StorageType value = 0)
291 FillImageWithConstValue(value);
297 void ClearChannel(
const unsigned int channel,
const StorageType value);
301 FillImageWithConstValue(StorageType Value);
304 FillImageWithConstValue(StorageType Value[]);
308 FillImageWithXValue();
316 SetPixel(
const StorageType & value,
const unsigned int & x,
317 const unsigned int & y,
const unsigned short int channel = 0);
326 SetPixel(
const StorageType & value0,
const StorageType & value1,
327 const StorageType & value2,
const unsigned int & x,
328 const unsigned int & y);
344 ScaleShift(
double Scale,
double Shift);
350 ScaleShiftChannel(
double Scale,
double Shift,
unsigned int channel);
358 ScaleShiftBetween(
double Min,
double Max);
375 StorageType* newMax = NULL);
379 CalcScaleShift(
double Min,
double Max,
double& Scale,
double &Shift)
const;
383 BelowThresholdToValue(StorageType Threshold, StorageType Value);
387 AboveThresholdToValue(StorageType Threshold, StorageType Value);
395 Binarize(StorageType Threshold);
401 Binarise(StorageType Threshold);
408 BinaryThreshold(StorageType Threshold, StorageType MinValue,
409 StorageType MaxValue);
444 operator/(
const StorageType& argimage)
const;
452 operator*(
const StorageType& argimage)
const;
468 operator-(
const StorageType& argimage)
const;
520 LinearInterpolation(
const unsigned int x,
const double y)
const;
525 LinearInterpolation(
const double x,
const unsigned int y)
const;
534 FastBilinearInterpolationGrey(
const double x,
const double y)
const;
545 BilinearInterpolation(
const double x,
const double y,
546 const unsigned short int channel = 0)
const;
552 inline bool CheckBilinearInterpolation(
const double x,
553 const double y)
const;
559 inline bool CheckBicubicInterpolation(
const double x,
560 const double y)
const;
566 BilinearInterpolationGrey(
const double x,
const double y)
const;
572 BilinearInterpolationRGBPlanar(
const double x,
const double y,
573 unsigned int channel)
const;
579 BilinearInterpolationRGBInterleaved(
const double x,
const double y,
580 unsigned int channel)
const;
586 DistanceWeightedInterpolationGrey(
const double x,
const double y)
const;
605 unsigned int hws_x,
unsigned int hws_y, StorageType* buffer);
615 BilinearInterpolationGreyMinVal(
const double x,
const double y,
616 const StorageType & minVal)
const;
626 BilinearInterpolationGreyMaxVal(
const double x,
const double y,
627 const StorageType & maxVal)
const;
643 BicubicInterpolation(
const double& x,
const double& y,
644 const unsigned short int channel = 0)
const;
667 RemoveChannel(
unsigned int channel);
678 DeleteNBorderPixel(
int n, StorageType delVal=StorageType(0));
690 PrintPointer(std::ostream &os)
const;
694 PrintData(std::ostream &os)
const;
707 Reciprocal(
const float factor = 1.0,
708 const unsigned short int channel = 0);
719 #include "ImageInline.hh"
723 #endif // __Image_hh__
DualQuaternion< T > operator/(const DualQuaternion< T > &l, const T &scalar)
void BilinearInterpolationShiftRegion(const double &x, const double &y, unsigned int hws_x, unsigned int hws_y, StorageType *buffer)
Interpolate shifted rectangular region centered at given subpixel position.
BIASMathBase_EXPORT Vector2< T > & operator/=(Vector2< T > &vec, const Vector2< T > &argvec)
elementwise division
DualQuaternion< T > operator-(const DualQuaternion< T > &l, const DualQuaternion< T > &r)
StorageType ** GetImageDataArray()
overloaded GetImageDataArray() from ImageBase
StorageType * GetImageData()
overloaded GetImageData() from ImageBase
Vector2< T > & operator-=(Vector2< T > &vec, const Vector2< T > &argvec)
sub operator for two Vectors
class BIASImageBase_EXPORT Image
void Clear(const StorageType value=0)
sets all pixels to zero/value
BIASMathBase_EXPORT Vector2< T > & operator+=(Vector2< T > &vec, const Vector2< T > &argvec)
add operator for two Vectors
Vector2< T > & operator*=(Vector2< T > &vec, const T &scalar)
Multiplication operator with scalar argument.
DualQuaternion< T > operator+(const DualQuaternion< T > &l, const DualQuaternion< T > &r)
The image template class for specific storage types.
DualQuaternion< T > operator*(const DualQuaternion< T > &l, const T &scalar)
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase
virtual Image< StorageType > * Clone() const
virtual covariant copy constructor which produces the same type of object as the template object (Ima...
This is the base class for images in BIAS.
const StorageType ** GetImageDataArray() const
overloaded GetImageDataArray() from ImageBase