www.pudn.com > Gesture[20040824].rar > Image.h
// Image.h: interface for the CImage class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_IMAGE_H__DC5894B2_86AB_4F8C_9D96_27233B820FB2__INCLUDED_) #define AFX_IMAGE_H__DC5894B2_86AB_4F8C_9D96_27233B820FB2__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include//#include inline int iplWidth( IplImage* img ) { return !img ? 0 : !(img->roi) ? img->width : img->roi->width; } inline int iplHeight( IplImage* img ) { return !img ? 0 : !(img->roi) ? img->height : img->roi->height; } class CImage { public: CImage(); ~CImage(); unsigned char ** CImage::ProcessArray(); unsigned char* image[500]; /* Create image (RGB or grayscale) */ bool Create( int w, int h, int bpp ); /* Load image from specified file */ bool LoadBMP2IPL( const char* filename, bool IsColor=true ); /* Load image from IplImage */ void LoadIPL2IPL( IplImage *image ); /* Load rectangle from the file */ bool LoadRect( const char* filename, int desired_color, RECT r ); /* Save entire image to specified file. */ void SaveIPL2BMP(const char *fout, IplImage *image); /* Get copy of input image ROI */ void CopyOf( CImage& image, int desired_color = -1 ); IplImage* GetImage() { return m_memDC != 0 ? &m_img : 0; } HDC GetDC() { return m_memDC; } void Destroy(void); /* put part of bitmap to specified destination rectangle */ void Show( HDC dc, int x, int y, int w, int h, int from_x, int from_y ); void Fill( COLORREF color ); /* width and height of ROI */ int Width() { return iplWidth( &m_img ); }; int Height() { return iplHeight( &m_img ); }; protected: void Clear(void); private: HDC m_memDC; HGDIOBJ m_old; IplImage m_img; }; void FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp ); #endif // !defined(AFX_IMAGE_H__DC5894B2_86AB_4F8C_9D96_27233B820FB2__INCLUDED_)