1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef bpi_DCR_EM_H
18#define bpi_DCR_EM_H
19
20/* ---- includes ----------------------------------------------------------- */
21
22#include "b_BasicEm/Context.h"
23#include "b_BasicEm/MemTbl.h"
24#include "b_ImageEm/UInt16ByteImage.h"
25#include "b_ImageEm/UInt32Image.h"
26#include "b_TensorEm/IdCluster2D.h"
27#include "b_TensorEm/RBFMap2D.h"
28#include "b_BitFeatureEm/Scanner.h"
29
30
31/* ---- related objects  --------------------------------------------------- */
32
33/* ---- typedefs ----------------------------------------------------------- */
34
35/* ---- constants ---------------------------------------------------------- */
36
37/** maximum size of dcr cluster */
38#define bpi_DCR_MAX_CLUSTER_SIZE 60
39
40/** maximum size of dcr sdk cluster */
41#define bpi_DCR_MAX_SDK_CLUSTER_SIZE 24
42
43/* ---- object definition -------------------------------------------------- */
44
45/** data carrier */
46struct bpi_DCR
47{
48	/* ---- temporary data ------------------------------------------------- */
49
50	/* ---- private data --------------------------------------------------- */
51
52	/* ---- public data ---------------------------------------------------- */
53
54	/** maximum allowed image width */
55	uint32 maxImageWidthE;
56
57	/** maximum allowed image height */
58	uint32 maxImageHeightE;
59
60	/** pointer to original image data */
61	void* imageDataPtrE;
62
63	/** width of original image */
64	uint32 imageWidthE;
65
66	/** height of original image */
67	uint32 imageHeightE;
68
69	/** offset refering to main and sdk clusters */
70	struct bts_Int16Vec2D offsE;
71
72	/** main cluster */
73	struct bts_IdCluster2D mainClusterE;
74
75	/** output cluster accessible by sdk users */
76	struct bts_IdCluster2D sdkClusterE;
77
78	/** confidence value ( 8.24 ) */
79	int32 confidenceE;
80
81	/** approval flag */
82	flag approvedE;
83
84	/** (image) id value */
85	int32 idE;
86
87	/** region of interest */
88	struct bts_Int16Rect roiRectE;
89
90	/** cue data */
91	struct bbs_UInt16Arr cueDataE;
92
93};
94
95/* ---- associated objects ------------------------------------------------- */
96
97/* ---- external functions ------------------------------------------------- */
98
99/* ---- \ghd{ constructor/destructor } ------------------------------------- */
100
101/** initializes data carrier */
102void bpi_DCR_init( struct bbs_Context* cpA,
103				   struct bpi_DCR* ptrA );
104
105/** destroys data carrier */
106void bpi_DCR_exit( struct bbs_Context* cpA,
107				   struct bpi_DCR* ptrA );
108
109/* ---- \ghd{ operators } -------------------------------------------------- */
110
111/* ---- \ghd{ query functions } -------------------------------------------- */
112
113/* ---- \ghd{ modify functions } ------------------------------------------- */
114
115/** create a data carrier */
116void bpi_DCR_create( struct bbs_Context* cpA,
117					 struct bpi_DCR* ptrA,
118					 uint32 imageWidthA,
119					 uint32 imageHeightA,
120					 uint32 cueSizeA,
121					 struct bbs_MemTbl* mtpA );
122
123/* ---- \ghd{ memory I/O } ------------------------------------------------- */
124
125/* ---- \ghd{ exec functions } --------------------------------------------- */
126
127/** references external byte gray image through memory block referenced by bufferPtrA to be used as input image */
128void bpi_DCR_assignGrayByteImage( struct bbs_Context* cpA,
129								  struct bpi_DCR* ptrA,
130								  const void* bufferPtrA,
131								  uint32 widthA,
132								  uint32 heightA );
133
134/** assigns external byte gray image as input image and region of interest.
135  *
136  * bufferPtrA:  pointer to memory block of imput image
137  * pRectA:		 rectangle describing region of interest
138  */
139void bpi_DCR_assignGrayByteImageROI( struct bbs_Context* cpA,
140									 struct bpi_DCR* ptrA,
141									 const void* bufferPtrA,
142									 uint32 widthA,
143									 uint32 heightA,
144									 const struct bts_Int16Rect* pRectA );
145
146/** returns confidence 8.24 fixed format */
147int32 bpi_DCR_confidence( struct bbs_Context* cpA,
148						  const struct bpi_DCR* ptrA );
149
150#endif /* bpi_DCR_EM_H */
151