So here is our function that samples a detection from our simulated sensor. You tell it what object you want to sample a detection from and it returns a detection from that object.
| 162 | // what object you want to sample a detection from and it returns a detection from that |
| 163 | // object. |
| 164 | detection sample_detection_from_sensor(long object_id) |
| 165 | { |
| 166 | DLIB_CASSERT(object_id < num_objects, |
| 167 | "You can't ask to sample a detection from an object that doesn't exist."); |
| 168 | detection temp; |
| 169 | // Set the measurements equal to the object's true property values plus a little bit of |
| 170 | // noise. |
| 171 | temp.measurements = object_properties[object_id] + randm(num_properties,1,rnd)*0.1; |
| 172 | return temp; |
| 173 | } |
| 174 | |
| 175 | // ---------------------------------------------------------------------------------------- |
| 176 |
no test coverage detected