Skip to content

Commit 93c9a46

Browse files
committed
线段合并与筛选部分
修改: detect_3d_cuboid/include/detect_3d_cuboid/detect_3d_cuboid.h 修改: detect_3d_cuboid/src/box_proposal_detail.cpp 修改: detect_3d_cuboid/src/object_3d_util.cpp 修改: object_slam/data/output_cam_poses.txt 修改: object_slam/data/output_obj_poses.txt 修改: object_slam/src/main_obj.cpp 新文件: wu/pic/merge_line.png 新文件: wu/pic/merge_lines_img.png
1 parent 5dc7cde commit 93c9a46

File tree

8 files changed

+129
-121
lines changed

8 files changed

+129
-121
lines changed

detect_3d_cuboid/include/detect_3d_cuboid/detect_3d_cuboid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class detect_3d_cuboid
110110
bool consider_config_1 = true; // false true
111111
bool consider_config_2 = true; // TODO
112112
bool whether_sample_cam_roll_pitch = true; // sample camera roll pitch in case don't have good camera pose TODO
113-
bool whether_sample_bbox_height = true; // sample object height as raw detection might not be accurate TODO
113+
bool whether_sample_bbox_height = false; // sample object height as raw detection might not be accurate TODO
114114

115115
int max_cuboid_num = 1; // 最终返回的立方体的个数.
116116
double nominal_skew_ratio = 1; // normally this 1, unless there is priors TODO 为什么是1??

detect_3d_cuboid/src/box_proposal_detail.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void detect_3d_cuboid::detect_cuboid( const cv::Mat& rgb_img,
6868
MatrixXd all_lines_raw,
6969
std::vector<ObjectSet>& all_object_cuboids)
7070
{
71+
cv::Mat merge_lines_img = rgb_img.clone();
7172
// 绘制上边缘采样点
7273
typedef cv::Point_<int> Point2i;
7374
std::vector<Point2i> simple_points;
@@ -276,7 +277,7 @@ void detect_3d_cuboid::detect_cuboid( const cv::Mat& rgb_img,
276277
inside_obj_edge_num++;
277278
}
278279

279-
// 在找到物体的边缘线之后合并边,并剔除短边,小区域的边缘合并应该更快.
280+
// STEP 【6.2 在找到物体的边缘线之后合并边,并剔除短边,小区域的边缘合并应该更快.
280281
// merge edges and remove short lines, after finding object edges. edge merge in small regions should be faster than all.
281282
// @PARAM 线段合并与筛选参数.
282283
double pre_merge_dist_thre = 20;
@@ -288,6 +289,13 @@ void detect_3d_cuboid::detect_cuboid( const cv::Mat& rgb_img,
288289
pre_merge_dist_thre, /*两条线段的距离(水平)阈值 20 像素*/
289290
pre_merge_angle_thre, /*角度阈值 5°*/
290291
edge_length_threshold); /*长度阈值 30 像素*/
292+
// 显示筛选之后的边缘线段.
293+
// cv::Mat output_img;
294+
// plot_image_with_edges(merge_lines_img, output_img, all_lines_merge_inobj, cv::Scalar(0,255,0));
295+
// cvNamedWindow("merge_lines_img");
296+
// cvMoveWindow("merge_lines_img",500, 300);
297+
// cv::imshow("merge_lines_img", output_img); //cv::waitKey(0);
298+
// cv::waitKey(0);
291299

292300
// 计算每条边缘线段的角度和中点.
293301
// @PARAM lines_inobj_angles 线段角度.

detect_3d_cuboid/src/object_3d_util.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ void plot_image_with_edges(const cv::Mat& rgb_img, cv::Mat& output_img, MatrixXd
229229
cv::line( output_img,
230230
cv::Point(all_lines(i,0),all_lines(i,1)),
231231
cv::Point(all_lines(i,2),all_lines(i,3)),
232-
cv::Scalar(255,0,0),
232+
color,
233233
2,
234-
8,
234+
16,
235235
0);
236236
}
237237

@@ -270,7 +270,7 @@ void atan2_vector(const VectorXd& y_vec, const VectorXd& x_vec, VectorXd& all_an
270270
{
271271
all_angles.resize(y_vec.rows());
272272
for (int i=0;i<y_vec.rows();i++)
273-
all_angles(i)=std::atan2(y_vec(i),x_vec(i)); // don't need normalize_to_pi, because my edges is from left to right, always [-90 90]
273+
all_angles(i)=std::atan2(y_vec(i),x_vec(i)); // don't need normalize_to_pi, because my edges is from left to right, always [-90 90]
274274
}
275275

276276
// remove the jumping angles from -pi to pi. to make the raw angles smoothly change.

object_slam/data/output_cam_poses.txt

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
# timestamp tx ty tz qx qy qz qw
22
1341841278.842700005 -2.5508 0.9872 1.1019 -0.487105 0.767307 -0.351903 0.223902
3-
1341841279.510699987 -2.50714 1.03048 1.10124 -0.461562 0.775729 -0.366783 0.22511
4-
1341841280.182499886 -2.43802 1.11963 1.10889 -0.424931 0.790305 -0.378947 0.226385
5-
1341841280.850699902 -2.31717 1.23147 1.10731 -0.359466 0.824981 -0.390042 0.195083
6-
1341841281.554600000 -2.14217 1.35789 1.10532 -0.290742 0.860755 -0.389059 0.152328
7-
1341841282.226500034 -1.89523 1.40953 1.09068 -0.202409 0.885341 -0.40533 0.10445
8-
1341841282.898699999 -1.66077 1.46572 1.09638 -0.145223 0.896608 -0.414582 0.0559195
9-
1341841283.566499949 -1.47444 1.55376 1.11695 0.0643819 -0.904795 0.420701 0.0145749
10-
1341841284.238800049 -1.28869 1.58972 1.10779 0.00887419 -0.90744 0.416488 0.0548845
11-
1341841284.906699896 -1.09625 1.63143 1.11132 -0.0566478 -0.904355 0.416638 0.0731171
12-
1341841285.612400055 -0.917698 1.61741 1.11494 -0.113882 -0.89541 0.420535 0.0917737
13-
1341841286.282700062 -0.744896 1.56828 1.11754 -0.158426 -0.887602 0.417686 0.112263
14-
1341841286.950599909 -0.578365 1.50296 1.13108 -0.242122 -0.866104 0.405503 0.163731
15-
1341841287.622699976 -0.450312 1.32198 1.12014 -0.295901 -0.85003 0.39333 0.187569
16-
1341841288.294600010 -0.35097 1.11516 1.11294 -0.359237 -0.838413 0.361904 0.192454
17-
1341841288.962699890 -0.244965 0.931285 1.15393 -0.398925 -0.8203 0.355545 0.203852
18-
1341841289.634599924 -0.286327 0.750536 1.14093 -0.4458 -0.795811 0.339263 0.229887
19-
1341841290.302999973 -0.447227 0.570507 1.07254 -0.503873 -0.764864 0.31722 0.245901
20-
1341841290.974499941 -0.514541 0.449574 1.05078 -0.549583 -0.735802 0.290654 0.268465
21-
1341841291.642600060 -0.492155 0.301914 1.05607 -0.615169 -0.681752 0.27543 0.284463
22-
1341841292.314699888 -0.419436 0.157769 1.07083 -0.642154 -0.654532 0.257837 0.304543
23-
1341841292.986599922 -0.3606 0.0185523 1.08313 -0.673023 -0.61836 0.240417 0.32691
24-
1341841293.654799938 -0.317561 -0.112948 1.09429 -0.706338 -0.572872 0.223473 0.350662
25-
1341841294.326600075 -0.291363 -0.233404 1.10598 -0.740427 -0.518029 0.207249 0.374782
26-
1341841294.995199919 -0.28193 -0.339128 1.12011 -0.773467 -0.454248 0.191965 0.398191
27-
1341841295.666599989 -0.287185 -0.440363 1.11261 -0.791778 -0.406709 0.191006 0.413753
28-
1341841296.334800005 -0.35629 -0.533005 1.08215 -0.804576 -0.367337 0.199111 0.42199
29-
1341841297.006500006 -0.376302 -0.679661 1.07604 -0.824974 -0.332328 0.176503 0.421691
30-
1341841297.678600073 -0.478545 -0.752956 1.05458 -0.841222 -0.290996 0.148666 0.430773
31-
1341841298.346600056 -0.586477 -0.832736 1.05828 -0.853203 -0.242483 0.124271 0.444752
32-
1341841299.018500090 -0.740049 -0.907865 1.06161 -0.867085 -0.198827 0.119219 0.440928
33-
1341841299.686599970 -0.896997 -0.974315 1.09037 -0.876217 -0.149383 0.104218 0.44617
34-
1341841300.365600109 -1.08486 -0.933684 1.07427 -0.888542 -0.100806 0.0760153 0.441081
35-
1341841301.033600092 -1.26975 -0.953483 1.07854 -0.894339 -0.059335 0.0551482 0.439996
36-
1341841301.705699921 -1.44424 -0.957546 1.08151 -0.89848 -0.00843194 0.0287523 0.43799
37-
1341841302.377599955 -1.61729 -0.962866 1.0929 -0.894357 0.0405403 -0.00640054 0.445467
38-
1341841303.045599937 -1.7865 -0.9481 1.10141 -0.886196 0.0920889 -0.0415617 0.452159
39-
1341841303.710599899 -1.95899 -0.854971 1.07882 -0.877651 0.152267 -0.067079 0.449492
40-
1341841304.378700018 -2.10755 -0.741061 1.06047 -0.86677 0.207493 -0.0880418 0.444866
41-
1341841305.050600052 -2.25597 -0.728059 1.09398 -0.85631 0.268882 -0.110317 0.426926
42-
1341841305.722700119 -2.35546 -0.616587 1.08952 -0.854212 0.296133 -0.107685 0.41356
43-
1341841306.390700102 -2.35447 -0.487155 1.07485 -0.836722 0.342874 -0.140569 0.403204
44-
1341841307.062700033 -2.33746 -0.392281 1.06007 -0.825751 0.383379 -0.15104 0.385152
45-
1341841307.730600119 -2.33025 -0.283792 1.06606 -0.813318 0.399456 -0.166423 0.388911
46-
1341841308.409899950 -2.42811 -0.206925 1.10269 -0.817834 0.400352 -0.146045 0.386699
47-
1341841309.109499931 -2.48908 -0.113798 1.12243 -0.811919 0.419376 -0.168116 0.36966
48-
1341841309.781599998 -2.53662 -0.0733959 1.13054 -0.783241 0.457761 -0.218751 0.359355
49-
1341841310.446799994 -2.64669 -0.045883 1.14161 -0.751956 0.52895 -0.224873 0.322811
50-
1341841311.150700092 -2.59144 0.0764771 1.11707 -0.735617 0.553996 -0.214286 0.325634
51-
1341841311.818599939 -2.54035 0.149577 1.10627 -0.715377 0.58493 -0.22578 0.308409
52-
1341841312.490499973 -2.54834 0.223896 1.12549 -0.696311 0.608264 -0.250882 0.286747
53-
1341841313.169600010 -2.49908 0.331058 1.10774 -0.670274 0.634578 -0.270037 0.274087
54-
1341841313.869499922 -2.52476 0.440428 1.1238 -0.634467 0.670124 -0.277469 0.267201
55-
1341841314.570600033 -2.55023 0.54036 1.13627 -0.595056 0.707356 -0.284963 0.253678
56-
1341841315.245599985 -2.56273 0.64024 1.15044 -0.552971 0.742852 -0.29185 0.239204
57-
1341841315.910799980 -2.45922 0.722149 1.12534 -0.507859 0.773881 -0.288667 0.24466
58-
1341841316.578599930 -2.35867 0.790816 1.10808 -0.473801 0.797762 -0.291719 0.232355
59-
1341841317.250600100 -2.29067 0.836817 1.09703 -0.45352 0.814145 -0.297019 0.20801
3+
1341841279.510699987 -2.49611 1.02798 1.09692 -0.46123 0.774884 -0.368437 0.226
4+
1341841280.182499886 -2.44448 1.13705 1.11314 -0.424318 0.791232 -0.378538 0.224978
5+
1341841280.850699902 -2.33913 1.2677 1.11823 -0.360014 0.824815 -0.389668 0.195521
6+
1341841281.554600000 -2.16944 1.40842 1.11967 -0.290366 0.857438 -0.394675 0.157223
7+
1341841282.226500034 -1.89733 1.43416 1.08681 -0.203764 0.881539 -0.411207 0.110808
8+
1341841282.898699999 -1.64607 1.47744 1.087 -0.147531 0.894959 -0.416682 0.0604875
9+
1341841283.566499949 -1.4473 1.54628 1.10455 0.0665609 -0.903929 0.422289 0.0124189
10+
1341841284.238800049 -1.25587 1.57136 1.09595 0.0106638 -0.907154 0.417145 0.0542895
11+
1341841284.906699896 -1.06036 1.61131 1.10193 -0.0552854 -0.904489 0.416501 0.0732775
12+
1341841285.612400055 -0.878137 1.60367 1.10959 -0.112637 -0.895736 0.420148 0.0919025
13+
1341841286.282700062 -0.692768 1.5793 1.12175 -0.157408 -0.888792 0.415774 0.111374
14+
1341841286.950599909 -0.511642 1.54222 1.14454 -0.240053 -0.868476 0.40281 0.160837
15+
1341841287.622699976 -0.400719 1.35099 1.12165 -0.289567 -0.851631 0.396349 0.183801
16+
1341841288.294600010 -0.313673 1.14707 1.10291 -0.343951 -0.844289 0.368744 0.181387
17+
1341841288.962699890 -0.183857 0.973407 1.14313 -0.386685 -0.824693 0.362125 0.198043
18+
1341841289.634599924 -0.179372 0.785913 1.13386 -0.434636 -0.796839 0.349625 0.232165
19+
1341841290.302999973 -0.193307 0.60991 1.11704 -0.491359 -0.761074 0.333647 0.260792
20+
1341841290.974499941 -0.298152 0.452212 1.06181 -0.541177 -0.730772 0.305328 0.282621
21+
1341841291.642600060 -0.353591 0.278266 1.02998 -0.606285 -0.679208 0.289124 0.295808
22+
1341841292.314699888 -0.297743 0.10352 1.04478 -0.628294 -0.659088 0.277715 0.306145
23+
1341841292.986599922 -0.252789 -0.0603353 1.05891 -0.659271 -0.62684 0.260515 0.323365
24+
1341841293.654799938 -0.223122 -0.206284 1.07252 -0.696272 -0.581634 0.238889 0.346179
25+
1341841294.326600075 -0.210681 -0.326777 1.08677 -0.735657 -0.523479 0.214306 0.372627
26+
1341841294.995199919 -0.214289 -0.414468 1.1037 -0.773559 -0.453726 0.188371 0.40032
27+
1341841295.666599989 -0.237584 -0.494276 1.09961 -0.791325 -0.40472 0.187476 0.418162
28+
1341841296.334800005 -0.291733 -0.590266 1.08078 -0.805648 -0.367076 0.195298 0.421954
29+
1341841297.006500006 -0.321801 -0.7201 1.0737 -0.824405 -0.333175 0.175667 0.422483
30+
1341841297.678600073 -0.427389 -0.785303 1.0507 -0.840329 -0.2926 0.149135 0.431266
31+
1341841298.346600056 -0.515017 -0.88919 1.06334 -0.854388 -0.244453 0.123453 0.441615
32+
1341841299.018500090 -0.678675 -0.951499 1.06052 -0.866305 -0.201125 0.120473 0.441078
33+
1341841299.686599970 -0.845125 -1.00694 1.08209 -0.874918 -0.151676 0.106104 0.447499
34+
1341841300.365600109 -1.03498 -0.972795 1.06606 -0.88827 -0.102539 0.0769644 0.441065
35+
1341841301.033600092 -1.2235 -0.988494 1.06859 -0.893887 -0.0606865 0.0555539 0.440678
36+
1341841301.705699921 -1.40233 -0.98794 1.06998 -0.897782 -0.0100333 0.0293902 0.439344
37+
1341841302.377599955 -1.5783 -0.991908 1.08077 -0.89368 0.0388662 -0.0058079 0.446982
38+
1341841303.045599937 -1.74969 -0.975318 1.08873 -0.885513 0.0905995 -0.041352 0.453815
39+
1341841303.710599899 -1.92686 -0.88949 1.06914 -0.87716 0.150637 -0.0668238 0.451036
40+
1341841304.378700018 -2.09421 -0.808896 1.06272 -0.868043 0.206418 -0.0868278 0.443118
41+
1341841305.050600052 -2.25063 -0.801478 1.09895 -0.856623 0.268074 -0.109954 0.4269
42+
1341841305.722700119 -2.35026 -0.681072 1.09008 -0.854183 0.294912 -0.107096 0.414643
43+
1341841306.390700102 -2.34032 -0.534267 1.06809 -0.835878 0.341378 -0.140845 0.406118
44+
1341841307.062700033 -2.33301 -0.447265 1.05748 -0.826215 0.38317 -0.151216 0.384296
45+
1341841307.730600119 -2.31678 -0.325837 1.06032 -0.81292 0.39816 -0.167091 0.390781
46+
1341841308.409899950 -2.41109 -0.240775 1.09582 -0.817363 0.398647 -0.146652 0.38922
47+
1341841309.109499931 -2.50347 -0.157258 1.12994 -0.813094 0.418576 -0.165899 0.368986
48+
1341841309.781599998 -2.56481 -0.115878 1.14546 -0.783905 0.459698 -0.217152 0.356393
49+
1341841310.446799994 -2.65585 -0.0684939 1.1455 -0.750486 0.529758 -0.227958 0.322742
50+
1341841311.150700092 -2.60606 0.0642221 1.11626 -0.733141 0.554116 -0.221436 0.326229
51+
1341841311.818599939 -2.64831 0.133327 1.14257 -0.707937 0.591653 -0.244168 0.298586
52+
1341841312.490499973 -2.64839 0.224862 1.15039 -0.687255 0.615845 -0.25715 0.286861
53+
1341841313.169600010 -2.54534 0.331359 1.10952 -0.663626 0.638212 -0.274531 0.277342
54+
1341841313.869499922 -2.52555 0.434844 1.11119 -0.631076 0.670018 -0.281926 0.270807
55+
1341841314.570600033 -2.55761 0.536203 1.13411 -0.594996 0.7063 -0.285547 0.256093
56+
1341841315.245599985 -2.5798 0.631633 1.15777 -0.554808 0.742502 -0.290173 0.238074
57+
1341841315.910799980 -2.48132 0.716362 1.13988 -0.510383 0.773677 -0.28653 0.242555
58+
1341841316.578599930 -2.3539 0.78305 1.1128 -0.477283 0.795462 -0.293554 0.230798
59+
1341841317.250600100 -2.27713 0.834704 1.09783 -0.462201 0.809715 -0.30432 0.195247

0 commit comments

Comments
 (0)