1 #ifndef __RELIABILITY_CLASSIFICATION__ 2 #define __RELIABILITY_CLASSIFICATION__ 5 #include "Classification.h" 8 #include "MobileObject.h" 11 #define RC_INFINITY DBL_MAX 25 inWall(
world::Wall2D *i_wall,
double i_enters,
int i_enter_type,
double i_leaves,
int i_leave_type);
30 int getEnteringType();
42 static int RC_MAX_PIXELS;
43 static int RC_MIN_PIXELS;
44 static double m_pixelDensity;
47 bool imageWorkingAreaNotComputed;
54 bool m_orderByDensity;
56 bool m_treatBorderOcclusion;
57 bool m_treatContextObjectOcclusion;
58 bool m_treatWallCoherence;
68 classificationCriteria m_rcIntraCriteria;
69 classificationCriteria m_rcInterCriteria;
72 double m_cuttingAreaRate;
73 double m_wallInsideLengthRate;
75 int RC_PROXIMITY_PIXELS;
77 double m_maxRoofAndBaseIntersectionRatio, m_maxBaseAndBaseIntersectionRatio;
79 double m_minPixelCoverageRatio;
94 double m_classifThres;
96 double m_classifThresInter;
102 std::multimap<DetectionProblemType, world::Wall2D *> m_pertinent_walls;
105 std::map<ObjectType, SpModelInterface> m_mapModels;
106 std::map<ObjectType, bool> sizeOkForAnalysis;
107 std::map<ObjectType, std::map<ObjectSubtype, bool> > subSizeOkForAnalysis;
109 std::map<int, std::map<ObjectType, double> > m_mapClassif;
113 std::map<ObjectType, std::deque<Shape3DData *> > m_top;
114 std::map<ObjectType, std::deque<Shape3DData *> > m_topocc;
115 std::map<ObjectType, int> m_ntop;
116 std::map<ObjectType, int> m_ntopocc;
119 std::map<ObjectType, s3ddata_t> best_valid;
120 std::map<ObjectType, bool> there_is_best_valid;
123 bool best_by_alpha_found, best_by_h_found;
124 double bestAlphaDistance, bestDimDistance;
125 double currentDimDistance;
129 std::map<ObjectType, std::map<ObjectSubtype, std::deque<Shape3DData *> > > m_sub_top;
130 std::map<ObjectType, std::map<ObjectSubtype, std::deque<Shape3DData *> > > m_sub_topocc;
131 std::map<ObjectType, std::map<ObjectSubtype, int> > m_sub_ntop;
132 std::map<ObjectType, std::map<ObjectSubtype, int> > m_sub_ntopocc;
134 std::map<ObjectType, std::map<ObjectSubtype, s3ddata_t> > sub_best_valid;
135 std::map<ObjectType, std::map<ObjectSubtype, bool> > sub_there_is_best_valid;
138 SpModelInterface m_currentModel;
139 ObjectType m_modelId;
140 ObjectSubtype m_subModelId;
143 double *g_postureMinw, *g_postureMinl, *g_postureMinh;
144 double *g_postureMaxw, *g_postureMaxl, *g_postureMaxh;
145 int Winitial, Hinitial;
146 double alphaInit, alphaMobile, alphaChange, alphaVar, hInit, dChange, hVar, hMin, hMax, hMobile, wMobile, lMobile;
152 std::deque<world::Wall2D *> real_walls;
154 std::deque<world::ContextObject *> near_objects;
156 std::deque<world::ContextObject *> not_near_objects;
158 std::map<world::ContextObject *, DetectionProblemType> object_occlusion_type;
160 std::deque<world::ContextObject *> near_objects_extended;
164 std::map<world::ContextObject *, std::map<int, std::deque<inWall> > > enteredWallsForPointLeft;
165 std::map<world::ContextObject *, std::map<int, std::deque<inWall> > > enteredWallsForPointRight;
166 std::map<world::ContextObject *, std::map<int, std::deque<inWall> > > enteredWallsForPointTop;
167 std::map<world::ContextObject *, std::map<int, std::deque<inWall> > > enteredWallsForPointBottom;
171 std::map<world::ContextObject *, std::map<int, double> > analyzedPointsForObjectX;
172 std::map<world::ContextObject *, std::map<int, double> > analyzedPointsForObjectY;
176 std::deque<world::WallSegment *> annoyingWallSegments;
178 double m_HToleranceCoeff, m_VToleranceCoeff;
179 double imgCamx, imgCamy;
180 double camx, camy, camz;
181 int m_XMinWA, m_XMaxWA, m_YMinWA, m_YMaxWA;
184 double borderMinLeft, borderMaxRight, borderMinTop, borderMaxBottom;
185 double objectMinLeft, objectMaxRight, objectMinTop, objectMaxBottom;
186 double OcclusionMinLeft, OcclusionMaxRight, OcclusionMinTop, OcclusionMaxBottom;
187 bool possible_occlusion;
188 double model_hmin, model_hmax, model_hmean,
189 model_lmin, model_lmax, model_lmean,
190 model_wmin, model_wmax, model_wmean;
192 Interval interval_modelw, interval_modelh, interval_modell;
194 double alpha, sina, cosa, beta;
197 int with_sol_counter, models_calculated_counter, global_models_calculated_counter, valid_models_counter, models_accepted_after_walls_checking;
207 int Case, a, b, c, d, sp_var;
217 k1, k2, k3, k4, k5, k6, k7, k8, k9, k10,
218 k11, k12, k13, k14, k15, k16, k17, k18, k19, k20,
219 k21, k22, k23, k24, k25, k26, k27, k28, k29, k30,
221 double Vl0, Vl1, Vl2, Vb0, Vb1, Vb2, Vr0, Vr1, Vr2, Vt0, Vt1, Vt2;
222 double ml0, ml1, mb0, mb1, mr0, mr1, mt0, mt1;
228 KK9, KK10, KK11, KK12,
229 KK13, KK14, KK15, KK16;
233 LL9, LL10, LL11, LL12,
236 double DD, MM1, MM2, MM3, MM4, MM5, MM6;
239 double K[22], L[5], C[16];
242 double d1, d2, d3, d4, d5, d6, d7, d8;
243 double wa, wb, wc, la, lb, lc;
256 int eq_relations[4][4];
263 bool someOcclusionSolutionInserted, someNormalSolutionInserted, aoi_in;
265 void constructClassifMap(std::vector<Blob>&, QImage *);
273 double convertAlpha(
double original_alpha);
275 double NormalizeAngle(
double alpha);
278 void computeImageWorkingArea(QImage *i_segm);
280 void initBlob3DData();
284 void adjustBlobLimitsByOcclusion(
Blob *blob);
287 DetectionProblemType isBlobOnImageBorder(
Blob *blob);
290 void setBlob3DFacts(
Blob *blob, QImage *i_segm);
293 void setLastBlobData(
double h,
double l,
double w,
double alpha,
Blob *blob,
bool _90_rotated);
297 double set_possible_solution(
double w,
double l,
double h,
Blob *blob,
bool rotated,
bool normal);
300 void fillOcclusionList(
Blob *blob);
303 double static_occlusion_search_alpha(
Blob *);
310 double static_occlusion_search_alpha(
Blob *, std::map<ObjectType, SpModelInterface>::iterator);
314 double search_solution_by_height(
Blob *, std::map<ObjectType, SpModelInterface>::iterator,
interval_t,
interval_t,
bool);
317 void addModel(ObjectType, SpModelInterface);
320 void removeBlob(
Blob *);
323 inline const std::map<int, std::map<ObjectType, double> >& getClassifMap()
const {
return m_mapClassif;}
326 inline const std::map<ObjectType, SpModelInterface>& getModelsMap()
const {
return m_mapModels;}
328 SpModelInterface getModelFromType(ObjectType);
332 void top_probabilities_and_reliabilities(
Blob *blob);
335 virtual void init_data();
348 bool can_be_inserted_top (
Blob *blob,
bool normalList);
356 void computeGeometricFacts(
Blob *blob);
360 virtual void updateScoreForType(
Blob *i_blob1, ObjectType i_blobType,
double i_score);
363 void buildClassifTable(
Blob *blob);
366 void RC_set_3D_bbox_blob_level_data(
Blob *blob);
369 void RC_set_3D_bbox_initial_alpha_level_data(
double alpha);
374 void RC_set_3D_bbox_alpha_level_data();
377 int RC_compute_blob_3Dbbox(
Blob *blob,
double h);
380 static void setPixelRates(
int bwidth,
int bheight,
double *horRate,
double *verRate);
386 void setExtraPixelInfo(
Blob *blob,
ddata_t ddata, QImage *i_segm);
392 static int get_nearest_from_middle_points(
parallelpiped_t _3Dbbox,
int limit);
395 void putBestByPixels(
bool occlusion);
399 double densityDistance(
ddata_t ddata);
401 double check_walls(
Blob *blob, DetectionProblemType octype);
405 DetectionProblemType isBlobOccludedByStaticObject(
Blob *blob);
409 double set_best_without_model_limits(
Blob *blob,
double w,
double l,
double h,
double alpha);
412 double getProbability(
double h,
double l,
double w);
415 void init_pertinent_occlusion_walls();
418 void check_walls_ver(
Blob *, DetectionProblemType);
421 void check_walls_hor(
Blob *, DetectionProblemType);
424 bool parallelpiped_base_inside_pertinent_walls(
Blob *,
double,
double);
428 double limits_by_max_possible_blob(
Blob *, DetectionProblemType);
432 void get_xy_k_distant_from_init_point(
double *,
double *,
double,
double,
double,
double,
double,
double);
435 void RC_compute_h_from_w(
double,
double *,
double *);
438 void RC_compute_h_from_l(
double,
double *,
double *);
441 int RC_compute_w_from_h(
double,
double *);
444 int RC_compute_l_from_h(
double,
double *);
447 void RC_get_h_from_w(
double,
double *,
double);
450 void RC_get_h_from_l(
double,
double *,
double);
453 int RC_set_3Dbbox_case_and_variable_indexes();
467 bool all_possible_base_inside(
bool [][3],
int);
470 int determine_points_inside_context_object(
world::ContextObject *,
double *,
double *,
bool [][3]);
473 void clearWallsInPoint();
486 bool getIntersectionWithSegment(
double,
double,
double,
world::WallSegment *,
bool,
double&);
489 DetectionProblemType correctBlobDetectionProblemType(
world::ContextObject *,
double[],
double[], DetectionProblemType);
492 void setObjectOcclusionLimit(
Blob *, DetectionProblemType,
bool);
498 void setAnnoyingWallsForContextWalls(
Blob *,
bool);
501 void setNearObjects(
Blob *);
505 void setMaxBlobNearObjects();
508 bool blobOverContextWalls(
Blob *);
513 double getX2DInHeight(std::map<int, double>,
world::Wall2D *,
double,
bool);
518 double getY2DInHeight(std::map<int, double>,
world::Wall2D *,
double,
bool);
521 bool noWallsValidatedSolution();
523 void checkBlobSize(
Blob *blob);
525 bool checkBlobSize(
int &reduced,
int &excesive,
s3ddata_t s3d, ObjectType type,
int position, DetectionProblemType occtype);
527 void checkSubModelsSize(
int &reduced,
int &excesive, SpModelInterface objectModel, ObjectType modelType,
Blob *blob);
529 void checkSubModelsSize(
int &reduced,
int &excesive, SpModelInterface objectModel, ObjectType modelType,
s3ddata_t s3d,
int position, DetectionProblemType occtype);
531 int checkIfBlobIsReducedSize(
Blob *blob,
double hmin,
double lmin,
double wmin);
533 int checkIfBlobIsReducedSize(
s3ddata_t s3d,
double hmin,
double lmin,
double wmin,
int position);
535 int checkIfBlobIsExcesiveSize(
Blob *blob,
double hmax,
double lmax,
double wmax);
537 int checkIfBlobIsExcesiveSize(
s3ddata_t s3d,
double hmax,
double lmax,
double wmax,
int position);
540 static void orderBlobsAscending(
double *values,
Blob **blobs,
int top,
int bottom);
542 static int getMiddle(
double *values,
Blob **blobs,
int top,
int bottom);
545 Shape3DData *getMostCoherentDataFromMobileAndBBoxLimit(
MobileObject *mobile, std::map<ObjectType, Shape3DData> *&normal,
546 std::map<ObjectType, Shape3DData> *&occ,
Blob *blob);
549 void setPostureLimits(ObjectType type);
551 bool reliability_tracking_search_alpha(
Blob *blob);
553 double search_solution_by_height_for_tracking(
Blob *blob,
interval_t interval_h,
double previous_best);
555 double set_possible_solution_for_tracking(
double w,
double l,
double h,
Blob *blob,
double current_best);
557 int calculate_hintervals_for_tracking(
interval_t interval_h_0);
558 int calculate_hintervals_for_tracking_old(
interval_t interval_h_0);
560 bool set_best_valid_alpha_for_tracking();
562 void limits_by_mean_model_values(
double *mean_limits,
double *starting_angles,
Blob *blob, DetectionProblemType octype);
564 void fillOcclusionListWithStartingPoints(
Blob *blob);
566 void static_occlusion_search_2D(
double *mean_limits,
double *starting_angles,
Blob *blob, DetectionProblemType occtype,
double dim_limit);
568 double static_occlusion_search_alpha_with_starting_point(
Blob *blob,
double& starting_alpha);
570 void limits_by_mean_model_values_bottom_occlusion(
double *mean_limits,
double *mean_left_limits,
double *mean_right_limits,
571 double *starting_angles,
Blob *blob,
bool with_left_occlusion,
574 void fillOcclusionListWithStartingPoints2(
Blob *blob);
576 int RC_set_3Dbbox_case_and_variable_indexes_simpler(
Blob *blob);
577 int RC_compute_blob_3Dbbox_get_case(
Blob *blob);
579 void RC_set_3D_bbox_alpha_level_data_get_case();
581 void RC_set_3D_bbox_alpha_level_data_simpler();
585 int RC_compute_blob_3Dbbox_simpler(
Blob *blob,
double h);
587 void static_occlusion_bottom_search_2D_in_corner(
double *mean_limits,
double *mean_left_limits,
double *mean_right_limits,
588 double *starting_angles,
Blob *blob, DetectionProblemType ver_occtype,
589 DetectionProblemType hor_occtype,
double ver_dim_limit,
double hor_dim_limit);
593 bool covering_bbox(
Blob *blob);
599 void prepareBlobForRClassification(
Blob *blob, QImage *i_segm);
601 void setDPForBlob(
Blob *blob, QImage *i_segm);
603 s3ddata_t getMostLikelyDataFromMobile(
Blob *blob, ObjectType type);
607 s3ddata_t generateS3DListsForBlob(
Blob *blob, ObjectType analyzed_type);
609 s3ddata_t addBestDataForType(
bool normal,
Blob *blob, ObjectType analyzed_type, std::map<ObjectType, Shape3DData> *s3d_list,
s3ddata_t data);
611 std::map<ObjectType, Shape3DData> *getBestOnesList(
bool normal,
Shape3DData **best_s3d,
double *best,
bool *exists3d,
Blob *i_blob);
613 void setExtraPixelInfo(
Blob *blob, QImage *i_segm);
615 bool positiveAngleDirection(
double beta,
double angle);
617 bool allowed_base_dimensions(
double w,
double l);
619 bool setParameters(QDomNode& config);
621 bool defaultParameters();
623 void classify(std::vector<Blob>& i_blobs, QImage *i_segm);
629 void assignTypeToBlob(
Blob *i_blob);
635 bool checkIfBetter(
double *best,
Shape3DData *s3d);
637 bool changeBlobTypeToUnknown(
Blob *i_blob);
641 typedef QSharedPointer<ReliabilityClassification> SpReliabilityClassification;
Definition: world_def.h:197
Definition: ReliabilityClassification.h:15
Definition: intervals.h:8
Definition: parallelpiped.h:8
Definition: calibration.h:51
Definition: ReliabilityClassification.h:37
Definition: world_def.h:275
Definition: world_def.h:240
An object of this class is instantiated at main code, and this object is used by every class to push ...
Definition: Datapool.h:39
Definition: geometric.h:224
Definition: BackgroundRecLigth.h:20
Definition: MobileObject.h:101