7 #ifndef _LIBALVISION_ALVISION_ALIMAGE_H_
8 #define _LIBALVISION_ALVISION_ALIMAGE_H_
30 ROI(
int left,
int top,
int width,
int height);
31 ROI(
int left,
int top,
int width,
int height,
59 ALImage(
int pWidth,
int pHeight,
int pColorSpace,
bool pDataAreExternal =
false,
60 float pLeftAngle = 0.f,
float pTopAngle = 0.f,
61 float pRightAngle = 0.f,
float pBottomAngle = 0.f);
74 ALImage(
int pResolution,
int pColorSpace,
bool pDataAreExternal =
false,
75 float pLeftAngle = 0.f,
float pTopAngle = 0.f,
76 float pRightAngle = 0.f,
float pBottomAngle = 0.f);
117 inline void setWidth(
const int width ) { fWidth = width; }
118 inline void setHeight(
const int height ) { fHeight = height; }
119 inline void setLeftAngle(
const float leftAngle ) { fFOV.leftAngle = leftAngle; }
120 inline void setTopAngle(
const float topAngle ) { fFOV.topAngle = topAngle; }
121 inline void setRightAngle(
const float rightAngle ) { fFOV.rightAngle = rightAngle; }
122 inline void setBottomAngle(
const float bottomAngle ) { fFOV.bottomAngle = bottomAngle; }
123 inline void setAngles(
const float leftAngle,
const float topAngle,
124 const float rightAngle,
const float bottomAngle )
125 { fFOV.leftAngle = leftAngle; fFOV.topAngle = topAngle;
126 fFOV.rightAngle = rightAngle; fFOV.bottomAngle = bottomAngle; }
153 { assert( fData != 0);
154 std::cout <<
"getFrame() is deprecated. Please replace by getData()." << std::endl;
162 inline const unsigned char*
getData()
const { assert( fData != 0);
return fData; }
171 { assert( fData != 0);
172 std::cout <<
"getFrame() is deprecated. Please replace by getData()." << std::endl;
180 inline unsigned char*
getData() { assert( fData != 0);
return fData; }
187 inline void setData(
unsigned char* pData) { fData = pData; }
196 if( (pTimeStamp.tv_usec < 0) || (pTimeStamp.tv_sec < 0) )
201 setTimeStamp(static_cast<int>(pTimeStamp.tv_sec), static_cast<int>(pTimeStamp.tv_usec));
209 inline void setTimeStamp(
long long pTimeStamp) { fTimeStamp = pTimeStamp; }
219 fTimeStamp = (
long long)pSeconds*1000000LL + (
long long)pMicroSeconds;
228 inline void setCameraId(
char pCameraId) { fCameraId = pCameraId; }
235 inline unsigned int getSize()
const {
return fWidth*fHeight*fNbLayers; }
240 inline int getWidth(
void )
const {
return fWidth; }
255 inline void getAngles(
float& leftAngle,
float& topAngle,
float& rightAngle,
float& bottomAngle )
256 const { leftAngle = fFOV.leftAngle; topAngle = fFOV.topAngle;
257 rightAngle = fFOV.rightAngle; bottomAngle = fFOV.bottomAngle; }
269 return &(fROIs[index]);
273 fROIs.push_back(rect);
281 fROIEnabled = enable;
289 int writeFile(
const char* _fileNameAndPath);
290 int readFile(
const char* _fileNameAndPath);
291 int savePPM(
const char* _fileNameAndPath);
298 bool reallocateDataSize(
const int resolution,
const int nbLayers);
316 long long fTimeStamp;
319 unsigned char* fData;
331 int fMaxNumberOfLayers;
335 bool fDataAreExternal;
346 std::vector<ROI> fROIs;
353 void computeRgbFromYuv(
unsigned char * pYR,
unsigned char * pUG,
unsigned char * pVB );
356 #endif // _LIBALVISION_ALVISION_ALIMAGE_H_
int getMaxResolution(void) const
int getResolution(void) const
bool setResolution(int pResolution)
set the Resolution of the image without changing the allocation size.
void getAngles(float &leftAngle, float &topAngle, float &rightAngle, float &bottomAngle) const
bool computeBGRimageFromYUV422(const unsigned char *_dest)
bool areDataExternal(void) const
int savePPM(const char *_fileNameAndPath)
float getBottomAngle(void) const
bool setColorSpace(int pColorSpace)
set the ColorSpace of the image without changing the allocation size.
unsigned char * getData()
return the pointer to the image data.
void setLeftAngle(const float leftAngle)
const unsigned char * getData() const
return the reference to the image data.
void setTimeStamp(long long pTimeStamp)
set the image timestamp
void setBottomAngle(const float bottomAngle)
int getResolutionFromSize(const int width, const int height)
Utility function that takes width and height as inputs and returns the corresponding resolution index...
void setTimeStamp(const qi::os::timeval pTimeStamp)
set the image timestamp.
void setHeight(const int height)
void setRightAngle(const float rightAngle)
void computeRgbFromYuv(unsigned char *pYR, unsigned char *pUG, unsigned char *pVB)
bool computeYYYYUUVVimageFromYUV422(const unsigned char *_dest)
float getRightAngle(void) const
void setEnableROIs(bool enable)
long long getTimeStamp(void) const
void addROI(const ROI &rect)
bool setSize(int pResolution)
set the Resolution of the image without changing the allocation size.
int writeFile(const char *_fileNameAndPath)
void setData(unsigned char *pData)
set the image data pointer to point to the specified buffer.
ALImage(int pWidth, int pHeight, int pColorSpace, bool pDataAreExternal=false, float pLeftAngle=0.f, float pTopAngle=0.f, float pRightAngle=0.f, float pBottomAngle=0.f)
constructor
int getColorSpace(void) const
static ALImage * fromALValue(const ALValue &image)
Allocate an ALImage and return a pointer on it using an ALValue to fill it.
const ROI * getROI(int index) const
int getNbOfLayersMax(void) const
unsigned int getSize() const
bool computeYUV422imageFromBGR(int height, int width, char *data)
const unsigned char * getFrame() const
return the reference to the image data.
void setWidth(const int width)
float getLeftAngle(void) const
void setTimeStamp(int pSeconds, int pMicroSeconds)
set the image timestamp
void setTopAngle(const float topAngle)
unsigned char * getFrame()
return the pointer to the image data.
int getHeight(void) const
bool computeYYYUUUVVVimageFromYUV422(const unsigned char *_dest)
int readFile(const char *_fileNameAndPath)
bool isROIEnabled() const
ROI(int left, int top, int width, int height)
int getNbLayers(void) const
std::string toString(void) const
void setCameraId(char pCameraId)
set the ID of the camera that shot the picture
int getAllocatedSize() const
ALValue toALValue()
return an ALValue containing image structure
void setAngles(const float leftAngle, const float topAngle, const float rightAngle, const float bottomAngle)
float getTopAngle(void) const