123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- #ifndef _IMAGEDLL_H_
- #define _IMAGEDLL_H_
- //#include <stddef.h>
- //#ifdef _WIN32
- //#include <windows.h>
- //#endif /* _WIN32 */
- #ifdef __cplusplus
- extern "C" {
- #endif /* __cplusplus */
- #ifdef _WIN32
- #define EL_CDECL __cdecl
- #define EL_STDCALL __stdcall
- #define EL_EXPORT __declspec(dllexport)
- #else
- #define EL_CDECL
- #define EL_STDCALL
- #define EL_EXPORT
- #endif
- #ifndef ELAPI
- #define ELAPI(rettype) EL_EXPORT rettype EL_CDECL
- #endif
- #ifdef __cplusplus
- #define EL_DEFAULT(val) = val
- #else
- #define EL_DEFAULT(val)
- #endif
- typedef void *ELimage;
- /* image file */
- typedef void *ELfile;
- #pragma pack(push, 1)
- typedef struct ELsize
- {
- int width;
- int height;
- }ELsize;
- typedef struct ELpoint
- {
- int x;
- int y;
- }ELpoint;
- typedef struct ELrect
- {
- int x;
- int y;
- int width;
- int height;
- }ELrect;
- typedef struct ELregion
- {
- ELpoint pt[4];
- }ELregion;
- #pragma pack(push, 1)
- //压缩率选项
- enum elCompressMode{
- EL_VIDEO_CAP_COMPRESS_HIGH=0,
- EL_VIDEO_CAP_COMPRESS_HIGHER,
- EL_VIDEO_CAP_COMPRESS_MEDIUM,
- EL_VIDEO_CAP_COMPRESS_LOWER,
- EL_VIDEO_CAP_COMPRESS_LOW
- };
- typedef unsigned int ELcolor;
- #define EL_INFO_LEVEL_FATAL 0x1
- #define EL_INFO_LEVEL_ERROR 0x2
- #define EL_INFO_LEVEL_WARNING 0x3
- #define EL_INFO_LEVEL_INFO 0x4
- /* image format */
- #define EL_FORMAT_UNKNOWN -1
- #define EL_FORMAT_BMP 0
- #define EL_FORMAT_ICO 1
- #define EL_FORMAT_JPEG 2
- #define EL_FORMAT_PNG 13
- #define EL_FORMAT_TIFF 18
- #define EL_FORMAT_GIF 25
- /* image load and save flag */
- #define EL_JPEG_QUALITYSUPERB 0x80 //! save with superb quality (100:1)
- #define EL_JPEG_QUALITYGOOD 0x0100 //! save with good quality (75:1)
- #define EL_JPEG_QUALITYNORMAL 0x0200 //! save with normal quality (50:1)
- #define EL_JPEG_QUALITYAVERAGE 0x0400 //! save with average quality (25:1)
- #define EL_JPEG_QUALITYBAD 0x0800 //! save with bad quality (10:1)
- //1~100 decimal integer x, save with x:1
- /* image create flag */
- #define EL_CREATE_TOP_LEFT 0x1
- #define EL_CREATE_BOTTOM_LEFT 0x2
- /* image channels */
- #define EL_CHANNELS_GRAY 0x1
- #define EL_CHANNELS_COLOR 0x3
- /* image prop */
- #define EL_PROP_WIDTH 0x1
- #define EL_PROP_HEIGHT 0x2
- #define EL_PROP_CHANNELS 0x3
- #define EL_PROP_WIDTHSTEP 0x4
- #define EL_PROP_XDPI 0x5
- #define EL_PROP_YDPI 0x6
- /* image cvt */
- #define EL_CVT_COLOR2GRAY 0x6
- #define EL_CVT_GRAY2COLOR 0x8
- /* image rotate */
- #define EL_ROTATE_KEEP_SIZE 0x0
- #define EL_ROTATE_KEEP_INFO 0x1
- /* image flip */
- #define EL_FLIP_HORIZONTAL 0
- #define EL_FLIP_VERTICAL 1
- #define EL_FLIP_BOTH -1
- #define EL_DESKEW_CLEAN 0
- #define EL_DESKEW_MORE 1
- /* image rectify */
- #define EL_RECTIFY_NONE 0
- #define EL_RECTIFY_IDCARD 1
- /* color */
- #define EL_RGB(r, g, b) ((ELcolor)(((unsigned char)(r) \
- | ((unsigned short)((unsigned char)(g)) << 8)) \
- | (((unsigned int)(unsigned char)(b)) << 16)))
- ELAPI(int)
- elWriteInfo(
- int level,
- const char *format,
- ...
- );
- ELAPI(int)
- elSetLogNameFormat(
- const char * prefix,
- int flag EL_DEFAULT(0)
- );
- //加载本地图片
- ELAPI(ELimage)
- elLoadImage(
- const char *fileName,
- int flag EL_DEFAULT(0)
- );
- //保存本地图片
- ELAPI(int)
- elSaveImage(
- ELimage image,
- const char *fileName,
- int flag EL_DEFAULT(0)
- );
- ELAPI(int)
- elAppendImage(
- ELfile file,
- ELimage image
- );
- ELAPI(ELfile)
- elCreateFile(
- const char *fileName,
- int flag EL_DEFAULT(0)
- );
- ELAPI(int)
- elLoadList(
- const char *fileName,
- ELimage *list,
- int *len,
- int flag EL_DEFAULT(0)
- );
- ELAPI(int)
- elSaveList(
- const char *fileName,
- ELimage *list,
- int len,
- int flag
- );
- ELAPI(int)
- elReleaseImage(
- ELimage image
- );
- ELAPI(int)
- elReleaseFile(
- ELfile file
- );
- ELAPI(HBITMAP)
- elCreateDIB(
- ELimage image
- );
- ELAPI(int)
- elGetImageCount(
- ELfile file
- );
- ELAPI(ELimage)
- elGetImage(
- ELfile file,
- int idx
- );
- ELAPI(ELfile)
- elOpenFile(
- const char *fileName,
- int flag EL_DEFAULT(0)
- );
- ELAPI(int)
- elAdaptiveThresholdImage(
- ELimage image,
- int flag EL_DEFAULT(0),
- ELimage *dest EL_DEFAULT(NULL)
- );
- //去底色
- ELAPI(int)
- elDelImageBkColor(
- ELimage image,
- ELimage *dest EL_DEFAULT(NULL)
- );
- //文字印章白底
- ELAPI(int)
- elDelImageBackgrand(
- ELimage image,
- ELimage *dest EL_DEFAULT(NULL)
- );
- //实现单双页展平 参数 bRemoveFinger 是否去除手指;flag 是否去除书籍边缘; bDouble ture表示切分成双页展平,false表示单页展平
- ELAPI(int)elZhanPinImage(BOOL bRemoveFinger, ELimage srcImg,
- ELimage *outImgLeft, ELimage *outImgRight, int flag,bool bDouble = true
- );
- #ifdef __cplusplus
- }
- #endif
- #endif
|