-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKFB.h
executable file
·183 lines (141 loc) · 5.71 KB
/
KFB.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// !Created by babiking on May 10th, 2018 for .kfb file format conversion...
// reference: [1]https://blog.csdn.net/ameyume/article/details/6326278
// [2]https://blog.csdn.net/loveyaqin1990/article/details/40015731
#ifndef KFB_CONVERT_TIFF_KFB_H
#define KFB_CONVERT_TIFF_KFB_H
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
typedef void *LPVOID;
typedef unsigned char BYTE;
typedef signed int KFB_INT32;
// !Create IMAGE_INFO_STRUCT to store pointer to file...
typedef struct IMAGE_INFO_STRUCT{
int DataFilePTR;
}ImageInfoStruct;
typedef struct HEADER_INFO_STRUCT
{
KFB_INT32 Height;
KFB_INT32 Width;
KFB_INT32 ScanScale;
float SpendTime;
double ScanTime;
float CapRes;
KFB_INT32 BlockSize;
}HeaderInfoStruct;
typedef struct POS_IDX_STRUCT
{
KFB_INT32 x;
KFB_INT32 y;
KFB_INT32 width;
KFB_INT32 height;
}PosIdxStruct;
// !Declare the functionType of InitImageFileFunc
/*
* Function:
* InitImageFileFunc(ImageInfoStruct sImageInfo,
* const char* path_to_kfb_file), i.e. DLLInitImageFileFunc- 'abstract' function pointer
* Input:
* [1] <const char*> path_to_kfb_file
* Output:
* [1] <ImageInfoStruct> sImageInfo: pointer to input digital image
* Return:
* [1] <int> returnFlag
*
* note: usage of TYPEDEF refer to https://blog.csdn.net/ameyume/article/details/6326278...
*
*/
typedef int (*DLLInitImageFileFunc)(ImageInfoStruct*, const char*);
// !Declare the functionType of GetHeaderInfoFunc
/*
* Function:
* int GetHeaderInfoFunc(ImageInfoStruct sImageInfo,
* KFB_INT32 khiImageHeight,
* KFB_INT32 khiImageWidth,
* KFB_INT32 khiScanScale,
* float* khiSpendTime,
* float* khiImageCapRes,
* KFB_INT32, khiImageBlockSize)
* Input:
* [1] <ImageInfoStruct> sImageInfo: pointer to input digital image
* Output:
* [1] <KFB_INT32> khiImageHeight: scanning height
* [2] <KFB_INT32> khiImageWidth: scanning width
* [3] <KFB_INT32> khiScanScale: scanning scale factor e.g. 40X
* [4] <float*> khiSpendTime: scanning acquisition time
* [5] <double*> khiScanTime: scanning start time
* [6] <float*> khiImageCapRes: ratio of the pixel and actual size
* [7] <KFB_INT32> khiImageBlockSize: size of scanning block
*/
typedef int (*DLLGetHeaderInfoFunc)(ImageInfoStruct*, KFB_INT32*, KFB_INT32*, KFB_INT32*, float*, double*, float*, KFB_INT32*);
// !Decalare the functionType of GetImageDataRoiFunc
/*
* Function:
* int GetImageDataRoiFunc(ImageInfoStruct sImageInfo,
* float fScale,
* int sp_x,
* int sp_y,
* int nWidth,
* int nHeight,
* BYTE** pBuffer,
* int* DataLength,
* bool flag)
* Input:
* [1] <ImageInfoStruct> sImageInfo: pointer to input digital image
* [2] <float> fScale: target scaling/resampling factor
* [3] <int> sp_x: x-coordinate of left-top corner
* [4] <int> sp_y: y-coordinate of left-top corner
* [5] <int> nWidth
* [6] <int> nHeight
* Output:
* [1] <BYTE**> pBuffer: pointer to return image block, format->.jpeg
* [2] <int*> DataLength: data length (BYTEs) of return image
* [3] <bool> flag: result of GetImageDataRoiFunc, true-success/false-fail
*
*/
typedef int (*DLLGetImageDataRoiFunc)(ImageInfoStruct*, float, KFB_INT32, KFB_INT32, KFB_INT32, KFB_INT32, BYTE**, KFB_INT32*, bool);
// !Declare the functionType of GetRGBDataStreamFunc
/*
* Function:
* char* GetImageRGBDataStreamFunc(ImageInfoStruct sImageInfo,
* float fScale,
* int nImagePosX,
* int nImagePosY,
* int* nDataLength,
* int* nImageWidth,
* int* nImageHeight,
* BYTE** ImageStream)
* Input:
* [1] <ImageInfoStruct> sImageInfo
* [2] <float> fScale
* [3] <int> nImagePosX
* [4] <int> nImagePosY: nImagePosX and nImagePosY should be the multiple of 256
* [5] <int*> nImageWidth
* [6] <int*> nImageHeight
* Output:
* [1] <int*> nDataLength
* [2] <BYTE**> ImageStream: the size of ImageStream is related to khiImageBlockSize e.g. 256
*
*/
typedef char* (*DLLGetImageRGBDataStreamFunc)(ImageInfoStruct*, float, KFB_INT32, KFB_INT32, KFB_INT32*, KFB_INT32*, KFB_INT32*, BYTE**);
// !Declare the functionType of DeleteImageDataFunc
/*
* Function:
* int DeleteImageDataFunc(LPVOID pImageData)
* Input:
* [1] <LPVOID> pImageData, i.e. the pointer of image block got by GetImageStreamFunc
*
*/
typedef int (*DLLDeleteImageDataFunc)(LPVOID);
// !Declare the functionType of UnInitImageFileFunc
/*
* Function:
* int UnInitImageFileFunc(ImageInfoStruct* sImageInfo)
* Input:
* [1] <ImageInfoStruct*> sImageInfo
*
*/
typedef int (*DLLUnInitImageFileFunc)(ImageInfoStruct*);
typedef bool (*DLLGetImageFunc)(ImageInfoStruct*, BYTE**, int*, int*, int*);
typedef void* (*DLLGetImageStreamFunc)(ImageInfoStruct*, float, int, int, int*, BYTE**);
#endif //KFB_CONVERT_TIFF_KFB_H