Add detected-object classification
This commit is contained in:
parent
6edf4f3f82
commit
947abbe92a
42
src/cpm.c
42
src/cpm.c
|
|
@ -500,6 +500,48 @@ static void set_values(int i, int j, uint64_t timestamp, CPM_t* cpm_tx, long his
|
|||
cpm_tx->cpm.cpmParameters.perceivedObjectContainer->list.array[j]->ySpeed.confidence = 40;
|
||||
cpm_tx->cpm.cpmParameters.perceivedObjectContainer->list.array[j]->objectRefPoint = ObjectRefPoint_bottomMid;
|
||||
|
||||
/* Detected Object Class*/
|
||||
cpm_tx->cpm.cpmParameters.perceivedObjectContainer->list.array[j]->classification = calloc(1, sizeof(ObjectClassDescription_t));
|
||||
ObjectClassDescription_t *class = cpm_tx->cpm.cpmParameters.perceivedObjectContainer->list.array[j]->classification;
|
||||
|
||||
class->list.size = 1 * sizeof(void*);
|
||||
class->list.array = malloc(1* sizeof(void*));
|
||||
class->list.count = 1;
|
||||
|
||||
class->list.array[0] = calloc(1, sizeof(ObjectClass_t));
|
||||
class->list.array[0]->confidence = 0;
|
||||
int obj_len = (int)(as_objects[i].f_objectLength*10);
|
||||
|
||||
if (obj_len == 10) {
|
||||
class->list.array[0]->Class.present = class_PR_person;
|
||||
class->list.array[0]->Class.choice.person.type = 1; // pedestrian
|
||||
class->list.array[0]->Class.choice.person.confidence = 0;
|
||||
} else if (obj_len == 16) {
|
||||
class->list.array[0]->Class.present = class_PR_person;
|
||||
class->list.array[0]->Class.choice.person.type = 3; // cyclist
|
||||
class->list.array[0]->Class.choice.person.confidence = 0;
|
||||
} else if (obj_len == 26) {
|
||||
class->list.array[0]->Class.present = class_PR_vehicle;
|
||||
class->list.array[0]->Class.choice.vehicle.type = 2; // motorcycle
|
||||
class->list.array[0]->Class.choice.vehicle.confidence = 0;
|
||||
} else if (obj_len >= 46 && obj_len <= 54) {
|
||||
class->list.array[0]->Class.present = class_PR_vehicle;
|
||||
class->list.array[0]->Class.choice.vehicle.type = 3; // passenger car
|
||||
class->list.array[0]->Class.choice.vehicle.confidence = 0;
|
||||
} else if (obj_len >= 56 && obj_len <= 88) {
|
||||
class->list.array[0]->Class.present = class_PR_vehicle;
|
||||
class->list.array[0]->Class.choice.vehicle.type = 5; // light truck
|
||||
class->list.array[0]->Class.choice.vehicle.confidence = 0;
|
||||
} else if (obj_len >= 90) {
|
||||
class->list.array[0]->Class.present = class_PR_vehicle;
|
||||
class->list.array[0]->Class.choice.vehicle.type = 6; // heavy truck
|
||||
class->list.array[0]->Class.choice.vehicle.confidence = 0;
|
||||
} else {
|
||||
class->list.array[0]->Class.present = class_PR_other;
|
||||
class->list.array[0]->Class.choice.other.type = 0; // unknown
|
||||
class->list.array[0]->Class.choice.other.confidence = 0;
|
||||
}
|
||||
|
||||
/* Fill History values */
|
||||
valid_array[as_objects[i].u8_objectID] = 1; // Comparation Array
|
||||
history_list[as_objects[i].u8_objectID][0] = (long)as_objects[i].f_xPoint * 100; // xPoint (Distance)
|
||||
|
|
|
|||
Loading…
Reference in New Issue