www.pudn.com > Gesture[20040824].rar > Image.h
// Image.h: interface for the CImage class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_IMAGE_H__096E30FC_24AD_4641_9D19_850123280AEB__INCLUDED_) #define AFX_IMAGE_H__096E30FC_24AD_4641_9D19_850123280AEB__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: unsigned char ** ProcessArray(); void Mean(int color[3],CRect rectoi); CImage * GetRect(CRect a); void Save2Bmp(const char * filename); CImage(); ~CImage(); CSize GetSize(); /* 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 ); //put all bmp ,to screen x,y void Show( HDC dc, int x, int y); void Fill( COLORREF color ); /* width and height of ROI */ int Width() { return iplWidth( &m_img ); }; int Height() { return iplHeight( &m_img ); }; IplImage m_img; protected: void Clear(void); private: HDC m_memDC; HGDIOBJ m_old; }; void FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp ); IplImage *GetRchannel(IplImage *image); IplImage *GetGchannel(IplImage *image); IplImage *GetBchannel(IplImage *image); void drawrectangle(CPoint p1, CPoint p2, COLORREF color, CDC * pDC,int method=0); void Thinning(IplImage *Img,CvSize size); #endif // !defined(AFX_IMAGE_H__096E30FC_24AD_4641_9D19_850123280AEB__INCLUDED_)