4 #include <QSharedPointer> 12 #include "parallelpiped.h" 17 #define BL_INFINITY DBL_MAX 41 void setNull(
Blob *blob);
42 void setNull(ObjectType type, ObjectSubtype subtype, DetectionProblemType dptype,
Rectangle<int> *bbox);
43 void copyBlobToShape3DData(
Blob *blob);
45 void copyShape3DDataOnlyInfo(
Shape3DData *copy_here);
46 void copyShape3DDataToBlob(
Blob *blob);
47 double horizontalDistanceToPoint(
double X2Dfpoint);
48 double verticalDistanceToPoint(
double Y2Dfpoint);
49 static std::map<ObjectType, Shape3DData>* copyList(std::map<ObjectType, Shape3DData>* list);
50 friend std::ostream& operator<<(std::ostream&,
const Shape3DData&);
53 ObjectSubtype subtype;
54 DetectionProblemType dp_type;
74 double maxDistanceFactor;
76 std::map<ObjectSubtype, Shape3DData> *subtypesList;
83 Blob(
int i_xleft,
int i_xright,
int i_top,
int y_bottom);
87 Blob *copyWithLists();
88 void setRectangle(
int i_xleft,
int i_xright,
int i_ytop,
int i_ybottom);
90 static void copyBlobList(std::vector<Blob>& list, std::vector<Blob>& new_list);
92 Blob *verticalSplitBlob(
int x2d);
93 Blob *horizontalSplitBlob(
int y2d);
95 void mergeBlob(
Blob *blob);
96 static Blob *getBiggest2D(std::vector<Blob>& blobs);
97 static ObjectType getTypeFromName(std::string name);
98 static std::string getNameFromType(ObjectType type);
99 static ObjectSubtype getSubtypeFromName(std::string name);
100 static std::string getNameFromSubtype(ObjectSubtype subtype);
101 static DetectionProblemType getDPTypeFromName(std::string name);
102 static std::string getNameFromDPType(DetectionProblemType octype);
103 static std::string getDPNameFromTypeDetailed(DetectionProblemType octype);
104 static double computeOverlapRatio(
Blob *b1,
Blob *b2);
105 static double computeIntersectRatio(
Blob *b1,
Blob *b2);
106 static double computeOverlapRatioStrict(
Blob *b1,
Blob *b2);
107 static bool isBlob1OverlapBlob2(
Blob *b1,
Blob *b2);
108 bool isPixBelongsToBlob(
int x,
int y);
109 static void whichBlobsPixelBelongsTo(std::list<Blob *>& list, std::vector<Blob>& blobs,
int x,
int y);
110 bool isBlobOccluded();
111 bool isBlobTopOccluded();
112 bool isBlobBottomOccluded();
113 int get3DBBox(
SceneModel *smodel,
double h,
double alpha);
114 int compute3DBBoxNormalCase(
SceneModel *smodel,
double h,
double alpha,
115 double V[4][4],
int limits[4][4],
116 int eq_relations[4][4],
int in_height[4]);
118 bool set3DBBox(
SceneModel *smodel,
double *X,
double *Y,
double h);
119 int compute3DBBoxSpecialCases(
SceneModel *smodel,
double h,
double alpha,
120 double V[4][4],
int limits[4][4],
int nlimits[4],
121 int eq_relations[4][4],
int in_height[4]);
123 void setInHeightGivenPosition(
int position,
int *in_height);
124 int getPositionRelativeToCamera(
SceneModel *smodel);
125 int getPositionRelativeToCameraOld(
SceneModel *smodel);
126 void setReal3DPosition();
127 void setEstimated3DPosition(
SceneModel* smodel);
128 void setPositionAtCenterBottom(
SceneModel* smodel);
129 static bool isBlob1InsideBlob2(
Blob *b1,
Blob *b2);
130 static bool same2DBlob(
Blob *b1,
Blob *b2);
131 static void set2Dand3Dbboxes(
SceneModel *smodel,
double *x,
double *y,
133 static void orderByProximityToPoint(std::vector<Blob>& blobs,
double x,
double y);
134 double horizontalDistanceToPoint(
double X2Dfpoint);
135 double verticalDistanceToPoint(
double Y2Dfpoint);
136 static void orderBlobsAscending(
double *values, std::vector<Blob>& blobs,
int top,
int bottom);
137 static int getMiddle(
double *values, std::vector<Blob>& blobs,
int top,
int bottom);
138 Shape3DData *getBestS3D(
bool &lastUnknown, ObjectType best_type,
double classifThreshold);
139 static void copyBlobData(
Blob *blob1,
Blob *blob2);
141 friend std::ostream& operator<<(std::ostream&,
const Blob&);
147 ObjectSubtype subtype;
148 DetectionProblemType dp_type;
192 std::map<ObjectType, Shape3DData> *normal_data;
194 std::map<ObjectType, Shape3DData> *occ_data;
204 int currentTimeDiffMilliSeconds;
210 double maxDistanceFactor;
213 typedef QSharedPointer<Blob> SpBlob;
216 #define BLOB_IDENT(_bl) ((_bl)->id) 218 #define BLOB_FRAME_NUMBER(_bl) ((_bl)->frameNumber) 219 #define BLOB_TIME_DIFF_MSEC(_bl) ((_bl)->currentTimeDiffMilliSeconds) 221 #define BLOB_IS_REDUCED_SIZE(_bl) ((_bl)->reduced_size) 222 #define BLOB_IS_EXCESIVE_SIZE(_bl) ((_bl)->excesive_size) 224 #define BLOB_BBOX(_bl) (&((_bl)->bbox)) 225 #define BLOB_3DBBOX(_bl) (&((_bl)->_3Dbbox)) 226 #define BLOB_DDATA(_bl) (&((_bl)->ddata)) 227 #define BLOB_MOVING_PIXELS(_bl) ((_bl)->moving_pixels) 229 #define DDATA_TP(_dd) (_dd)->TP 230 #define DDATA_TN(_dd) (_dd)->TN 231 #define DDATA_FP(_dd) (_dd)->FP 232 #define DDATA_FN(_dd) (_dd)->FN 233 #define DDATA_NPIX(_dd) (_dd)->npixels 234 #define DDATA_HRATE(_dd) (_dd)->hrate 235 #define DDATA_VRATE(_dd) (_dd)->vrate 236 #define DDATA_COLS_NUM(_dd) (_dd)->ncols 238 #define BLOB_3DBBOX_H(_bl) (PARALL_H(BLOB_3DBBOX(_bl))) 239 #define BLOB_3DBBOX_X_i(_bl, _i) (PARALL_X_i(BLOB_3DBBOX(_bl), _i)) 240 #define BLOB_3DBBOX_Y_i(_bl, _i) (PARALL_Y_i(BLOB_3DBBOX(_bl), _i)) 241 #define BLOB_3DBBOX_POINT_i(_bl, _i) (PARALL_POINT_i(BLOB_3DBBOX(_bl), _i)) 243 #define BLOB_3DBBOX_X2D_BASE_i(_bl, _i) (PARALL_X2D_BASE_i(BLOB_3DBBOX(_bl), _i)) 244 #define BLOB_3DBBOX_Y2D_BASE_i(_bl, _i) (PARALL_Y2D_BASE_i(BLOB_3DBBOX(_bl), _i)) 245 #define BLOB_3DBBOX_2D_BASE_POINT_i(_bl, _i) (PARALL_2D_BASE_POINT_i(BLOB_3DBBOX(_bl), _i)) 247 #define BLOB_3DBBOX_X2D_H_i(_bl, _i) (PARALL_X2D_H_i(BLOB_3DBBOX(_bl), _i)) 248 #define BLOB_3DBBOX_Y2D_H_i(_bl, _i) (PARALL_Y2D_H_i(BLOB_3DBBOX(_bl), _i)) 249 #define BLOB_3DBBOX_2D_H_POINT_i(_bl, _i) (PARALL_2D_H_POINT_i(BLOB_3DBBOX(_bl), _i)) 251 #define BLOB_POSITION(_bl) ((_bl)->position) 253 #define BLOB_XLEFT(_bl) (RECT_XLEFT(BLOB_BBOX(_bl))) 254 #define BLOB_X(_bl) (BLOB_XLEFT(_bl)) 255 #define BLOB_XRIGHT(_bl) (RECT_XRIGHT(BLOB_BBOX(_bl))) 256 #define BLOB_YTOP(_bl) (RECT_YTOP(BLOB_BBOX(_bl))) 257 #define BLOB_Y(_bl) (BLOB_YTOP(_bl)) 258 #define BLOB_YBOTTOM(_bl) (RECT_YBOTTOM(BLOB_BBOX(_bl))) 260 #define BLOB_WIDTH(_bl) (RECT_WIDTH(BLOB_BBOX(_bl))) 261 #define BLOB_HEIGHT(_bl) (RECT_HEIGHT(BLOB_BBOX(_bl))) 263 #define BLOB_XCENTER(_bl) (BLOB_XLEFT(_bl) + BLOB_WIDTH(_bl)/2) 264 #define BLOB_YCENTER(_bl) (BLOB_YTOP(_bl) + BLOB_HEIGHT(_bl)/2) 266 #define BLOB_TYPE(_bl) ((_bl)->type) 267 #define BLOB_SUBTYPE(_bl) ((_bl)->subtype) 268 #define BLOB_DP_TYPE(_bl) ((_bl)->dp_type) 270 #define BLOB_3D_WIDTH(_bl) ((_bl)->w) 271 #define BLOB_3D_HEIGHT(_bl) ((_bl)->h) 272 #define BLOB_3D_LENGTH(_bl) ((_bl)->l) 274 #define BLOB_PW(_bl) ((_bl)->P[0]) 275 #define BLOB_PH(_bl) ((_bl)->P[1]) 276 #define BLOB_PL(_bl) ((_bl)->P[2]) 277 #define BLOB_RW(_bl) ((_bl)->R[0]) 278 #define BLOB_RH(_bl) ((_bl)->R[1]) 279 #define BLOB_RL(_bl) ((_bl)->R[2]) 281 #define BLOB_ALPHA(_bl) ((_bl)->alpha) 282 #define BLOB_BETA(_bl) ((_bl)->beta) 283 #define BLOB_BETA_DIRECTION(_bl) ((_bl)->beta_direction) 285 #define BLOB_P(_bl) ((_bl)->gP) 286 #define BLOB_R(_bl) ((_bl)->gR) 287 #define BLOB_PR(_bl) ((_bl)->gPR) 288 #define BLOB_DP(_bl) ((_bl)->gDP) 290 #define BLOB_OCCLUSION(_bl) ((_bl)->occlusion) 292 #define BLOB_NORMAL_3DDATA(_bl) ((_bl)->normal_data) 293 #define BLOB_OCC_3DDATA(_bl) ((_bl)->occ_data) 294 #define BLOB_BEST_3DDATA(_bl) ((_bl)->best_data) 296 #define BLOB_3D_X(_bl) ((_bl)->position3D.x) 297 #define BLOB_3D_Y(_bl) ((_bl)->position3D.y) 298 #define BLOB_3D_Z(_bl) ((_bl)->position3D.z) 299 #define BLOB_3D_POSITION(_bl) (&(_bl)->position3D) 302 #define S3D_TYPE(_s3d) ((_s3d)->type) 303 #define S3D_SUBTYPE(_s3d) ((_s3d)->subtype) 304 #define S3D_DP_TYPE(_s3d) ((_s3d)->dp_type) 306 #define S3D_BBOX(_s3d) (&((_s3d)->bbox)) 307 #define S3D_3DBBOX(_s3d) (&((_s3d)->_3Dbbox)) 308 #define S3D_DDATA(_s3d) (&((_s3d)->ddata)) 310 #define S3D_XLEFT(_s3d) (RECT_XLEFT(S3D_BBOX(_s3d))) 311 #define S3D_X(_s3d) (S3D_XLEFT(_s3d)) 312 #define S3D_XRIGHT(_s3d) (RECT_XRIGHT(S3D_BBOX(_s3d))) 313 #define S3D_YTOP(_s3d) (RECT_YTOP(S3D_BBOX(_s3d))) 314 #define S3D_Y(_s3d) (S3D_YTOP(_s3d)) 315 #define S3D_YBOTTOM(_s3d) (RECT_YBOTTOM(S3D_BBOX(_s3d))) 316 #define S3D_WIDTH(_s3d) (RECT_WIDTH(S3D_BBOX(_s3d))) 317 #define S3D_HEIGHT(_s3d) (RECT_HEIGHT(S3D_BBOX(_s3d))) 318 #define S3D_XCENTER(_s3d) (S3D_XLEFT(_s3d) + S3D_WIDTH(_s3d)/2) 319 #define S3D_YCENTER(_s3d) (S3D_YTOP(_s3d) + S3D_HEIGHT(_s3d)/2) 321 #define S3D_3DBBOX_H(_s3d) (PARALL_H(S3D_3DBBOX(_s3d))) 322 #define S3D_3DBBOX_X_i(_s3d, _i) (PARALL_X_i(S3D_3DBBOX(_s3d), _i)) 323 #define S3D_3DBBOX_Y_i(_s3d, _i) (PARALL_Y_i(S3D_3DBBOX(_s3d), _i)) 324 #define S3D_3DBBOX_POINT_i(_s3d, _i) (PARALL_POINT_i(S3D_3DBBOX(_s3d), _i)) 326 #define S3D_3DBBOX_X2D_BASE_i(_s3d, _i) (PARALL_X2D_BASE_i(S3D_3DBBOX(_s3d), _i)) 327 #define S3D_3DBBOX_Y2D_BASE_i(_s3d, _i) (PARALL_Y2D_BASE_i(S3D_3DBBOX(_s3d), _i)) 328 #define S3D_3DBBOX_2D_BASE_POINT_i(_s3d, _i) (PARALL_2D_BASE_POINT_i(S3D_3DBBOX(_s3d), _i)) 330 #define S3D_3DBBOX_X2D_H_i(_s3d, _i) (PARALL_X2D_H_i(S3D_3DBBOX(_s3d), _i)) 331 #define S3D_3DBBOX_Y2D_H_i(_s3d, _i) (PARALL_Y2D_H_i(S3D_3DBBOX(_s3d), _i)) 332 #define S3D_3DBBOX_2D_H_POINT_i(_s3d, _i) (PARALL_2D_H_POINT_i(S3D_3DBBOX(_s3d), _i)) 334 #define S3D_3D_X(_s3d) ((_s3d)->position3D.x) 335 #define S3D_3D_Y(_s3d) ((_s3d)->position3D.y) 336 #define S3D_3D_Z(_s3d) ((_s3d)->position3D.z) 337 #define S3D_3D_POSITION(_s3d) (&(_s3d)->position3D) 339 #define S3D_W(_s3d) ((_s3d)->w) 340 #define S3D_H(_s3d) ((_s3d)->h) 341 #define S3D_L(_s3d) ((_s3d)->l) 343 #define S3D_PW(_s3d) ((_s3d)->Pw) 344 #define S3D_PH(_s3d) ((_s3d)->Ph) 345 #define S3D_PL(_s3d) ((_s3d)->Pl) 347 #define S3D_RW(_s3d) ((_s3d)->Rw) 348 #define S3D_RH(_s3d) ((_s3d)->Rh) 349 #define S3D_RL(_s3d) ((_s3d)->Rl) 351 #define S3D_R(_s3d) ((_s3d)->R) 352 #define S3D_P(_s3d) ((_s3d)->P) 353 #define S3D_PR(_s3d) ((_s3d)->PR) 354 #define S3D_DP(_s3d) ((_s3d)->DP) 356 #define S3D_ALPHA(_s3d) ((_s3d)->alpha) 358 #define S3D_SUBTYPES_LIST(_s3d) ((_s3d)->subtypesList) 366 unsigned int maxLength;
369 std::deque<SpBlob> trackedBlobs;
372 std::deque<SpBlob>::iterator begin();
373 std::deque<SpBlob>::iterator end();
374 std::deque<SpBlob>::reverse_iterator rbegin();
375 std::deque<SpBlob>::reverse_iterator rend();
376 SpBlob operator[](
int);
381 void resetMaxLength(
int);
383 friend std::ostream& operator<<(std::ostream&,
const blobBuffer&);
Definition: parallelpiped.h:8
Definition: calibration.h:51