Apollo 10.0
自动驾驶开放平台
similar.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 The Apollo Authors. All Rights Reserved.
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 *****************************************************************************/
17
19
20namespace apollo {
21namespace perception {
22namespace camera {
23
26 auto n = frame1->detected_objects.size();
27 auto m = frame2->detected_objects.size();
28 if ((n && m) == 0) {
29 return false;
30 }
31 sim->Reshape({static_cast<int>(n), static_cast<int>(m)});
32 float *sim_data = sim->mutable_cpu_data();
33 auto dim =
34 frame1->detected_objects[0]->camera_supplement.object_feature.size();
35 for (auto &object1 : frame1->detected_objects) {
36 for (auto &object2 : frame2->detected_objects) {
37 float s = 0.0f;
38 for (size_t k = 0; k < dim; ++k) {
39 s += object1->camera_supplement.object_feature[k] *
40 object2->camera_supplement.object_feature[k];
41 }
42 *sim_data = s;
43 ++sim_data;
44 }
45 }
46 return true;
47}
48
49} // namespace camera
50} // namespace perception
51} // namespace apollo
A wrapper around SyncedMemory holders serving as the basic computational unit for images,...
Definition blob.h:88
bool Calc(CameraTrackingFrame *frame1, CameraTrackingFrame *frame2, base::Blob< float > *sim) override
Definition similar.cc:24
for dynamic models (perfect model excluded)
class register implement
Definition arena_queue.h:37