我正在尝试借助opencv函数rgbd :: plane进行平面分割。我首先从一个csv文件创建一个深度图,将其转换为cv :: Mat :: vector,然后在分割之前计算法线。但是该函数导致一个free():下一个(快速)大小错误。似乎在于这行代码。 plane_finder(points3d_,法线,table_mask_,plane_coefficients);
我对编程还很陌生,因此,非常感谢您的帮助!
int
main (int argc, char** argv)
{
//Function that creates Mat_<Vec3f> points3d_ through csv file
//Normalestimation
rgbd::RgbdNormals normal_computer_ = rgbd::RgbdNormals(points3d_.rows, points3d_.cols, CV_32F,K_, 5, rgbd::RgbdNormals::RGBD_NORMALS_METHOD_FALS);
Mat normals = Mat (points3d_.rows, points3d_.cols, CV_8UC1);
normal_computer_(points3d_, normals);
std::vector<Mat> channels;
split(normals, channels);
Mat channel_view;
Mat(abs(channels[2])).convertTo(channel_view, CV_8U, 255);
//Planeseg
//Mat table_mask_ = Mat(points3d_.size(),points3d_.type());
Mat table_mask_;
std::vector<Vec4f> plane_coefficients;
rgbd::RgbdPlane plane_finder;
std::cerr <<" blocksize" << plane_finder.getBlockSize() << " data points." << std::endl;
plane_finder.setThreshold((float)0.02);
plane_finder.setMinSize((size_t)10000);
plane_finder(points3d_, normals, table_mask_, plane_coefficients);
std::cout << "Found " << plane_coefficients.size() << " planes." << std::endl;
return (0);}```
**and the error:
blocksize40 data points.
* Error in `./plane': free(): invalid next size (fast): 0x00000000012bf7c0 *
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fb86c9d67e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fb86c9df37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fb86c9e353c]
/opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_core3.so.3.3(_ZN2cv3Mat10deallocateEv+0xb9)[0x7fb86d7b2d89]
./plane(_ZN2cv3Mat7releaseEv+0x4f)[0x421c37]
./plane(_ZN2cv3MatD1Ev+0x18)[0x421982]
/opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_rgbd3.so.3.3(_ZN2cv4rgbd9RgbdPlaneclERKNS_11_InputArrayES4_RKNS_12_OutputArrayES7_+0x30cc)[0x7fb86e51560c]
./plane(main+0x991)[0x420d55]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fb86c97f830]
./plane(_start+0x29)[0x4200b9]
======= Memory map: ========
00400000-00435000 r-xp 00000000 08:01 24905770 /home/julian/Documents/CVplane/plane
00634000-00635000 r--p 00034000 08:01 24905770 /home/julian/Documents/CVplane/plane
00635000-00636000 rw-p 00035000 08:01 24905770 /home/julian/Documents/CVplane/plane
012ab000-029e0000 rw-p 00000000 00:00 0 [heap]
7fb860000000-7fb860021000 rw-p 00000000 00:00 0
7fb860021000-7fb864000000 ---p 00000000 00:00 0
7fb8679b8000-7fb86812d000 rw-p 00000000 00:00 0
7fb868cc9000-7fb868f46000 rw-p 00000000 00:00 0
7fb868f46000-7fb868f9d000 r-xp 00000000 08:01 15993424 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_flann3.so.3.3.1
7fb868f9d000-7fb86919d000 ---p 00057000 08:01 15993424 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_flann3.so.3.3.1
7fb86919d000-7fb86919f000 r--p 00057000 08:01 15993424 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_flann3.so.3.3.1
7fb86919f000-7fb8691a0000 rw-p 00059000 08:01 15993424 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_flann3.so.3.3.1
7fb8691a0000-7fb86927a000 r-xp 00000000 08:01 15993417 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_features2d3.so.3.3.1
7fb86927a000-7fb86947a000 ---p 000da000 08:01 15993417 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_features2d3.so.3.3.1
7fb86947a000-7fb86947f000 r--p 000da000 08:01 15993417 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_features2d3.so.3.3.1
7fb86947f000-7fb869481000 rw-p 000df000 08:01 15993417 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_features2d3.so.3.3.1
7fb869481000-7fb869482000 rw-p 00000000 00:00 0
7fb869482000-7fb86949b000 r-xp 00000000 08:01 51647213 /lib/x86_64-linux-gnu/libz.so.1.2.8
7fb86949b000-7fb86969a000 ---p 00019000 08:01 51647213 /lib/x86_64-linux-gnu/libz.so.1.2.8
7fb86969a000-7fb86969b000 r--p 00018000 08:01 51647213 /lib/x86_64-linux-gnu/libz.so.1.2.8
7fb86969b000-7fb86969c000 rw-p 00019000 08:01 51647213 /lib/x86_64-linux-gnu/libz.so.1.2.8
7fb86969c000-7fb8696a3000 r-xp 00000000 08:01 51646310 /lib/x86_64-linux-gnu/librt-2.23.so
7fb8696a3000-7fb8698a2000 ---p 00007000 08:01 51646310 /lib/x86_64-linux-gnu/librt-2.23.so
7fb8698a2000-7fb8698a3000 r--p 00006000 08:01 51646310 /lib/x86_64-linux-gnu/librt-2.23.so
7fb8698a3000-7fb8698a4000 rw-p 00007000 08:01 51646310 /lib/x86_64-linux-gnu/librt-2.23.so
7fb8698a4000-7fb8698bc000 r-xp 00000000 08:01 51646314 /lib/x86_64-linux-gnu/libpthread-2.23.so
7fb8698bc000-7fb869abb000 ---p 00018000 08:01 51646314 /lib/x86_64-linux-gnu/libpthread-2.23.so
7fb869abb000-7fb869abc000 r--p 00017000 08:01 51646314 /lib/x86_64-linux-gnu/libpthread-2.23.so
7fb869abc000-7fb869abd000 rw-p 00018000 08:01 51646314 /lib/x86_64-linux-gnu/libpthread-2.23.so
7fb869abd000-7fb869ac1000 rw-p 00000000 00:00 0
7fb869ac1000-7fb869ac4000 r-xp 00000000 08:01 51646312 /lib/x86_64-linux-gnu/libdl-2.23.so
7fb869ac4000-7fb869cc3000 ---p 00003000 08:01 51646312 /lib/x86_64-linux-gnu/libdl-2.23.so
7fb869cc3000-7fb869cc4000 r--p 00002000 08:01 51646312 /lib/x86_64-linux-gnu/libdl-2.23.so
7fb869cc4000-7fb869cc5000 rw-p 00003000 08:01 51646312 /lib/x86_64-linux-gnu/libdl-2.23.so
7fb869cc5000-7fb86c2e4000 r-xp 00000000 08:01 15993429 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_imgproc3.so.3.3.1
7fb86c2e4000-7fb86c4e4000 ---p 0261f000 08:01 15993429 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_imgproc3.so.3.3.1
7fb86c4e4000-7fb86c4fa000 r--p 0261f000 08:01 15993429 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_imgproc3.so.3.3.1
7fb86c4fa000-7fb86c51c000 rw-p 02635000 08:01 15993429 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_imgproc3.so.3.3.1
7fb86c51c000-7fb86c5bb000 rw-p 00000000 00:00 0
7fb86c5bb000-7fb86c75c000 r-xp 00000000 08:01 15993430 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_calib3d3.so.3.3.1
7fb86c75c000-7fb86c95b000 ---p 001a1000 08:01 15993430 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_calib3d3.so.3.3.1
7fb86c95b000-7fb86c95d000 r--p 001a0000 08:01 15993430 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_calib3d3.so.3.3.1
7fb86c95d000-7fb86c95e000 rw-p 001a2000 08:01 15993430 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_calib3d3.so.3.3.1
7fb86c95e000-7fb86c95f000 rw-p 00000000 00:00 0
7fb86c95f000-7fb86cb1f000 r-xp 00000000 08:01 51646327 /lib/x86_64-linux-gnu/libc-2.23.so
7fb86cb1f000-7fb86cd1f000 ---p 001c0000 08:01 51646327 /lib/x86_64-linux-gnu/libc-2.23.so
7fb86cd1f000-7fb86cd23000 r--p 001c0000 08:01 51646327 /lib/x86_64-linux-gnu/libc-2.23.so
7fb86cd23000-7fb86cd25000 rw-p 001c4000 08:01 51646327 /lib/x86_64-linux-gnu/libc-2.23.so
7fb86cd25000-7fb86cd29000 rw-p 00000000 00:00 0
7fb86cd29000-7fb86cd3f000 r-xp 00000000 08:01 51647060 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb86cd3f000-7fb86cf3e000 ---p 00016000 08:01 51647060 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb86cf3e000-7fb86cf3f000 rw-p 00015000 08:01 51647060 /lib/x86_64-linux-gnu/libgcc_s.so.1
7fb86cf3f000-7fb86d047000 r-xp 00000000 08:01 51646330 /lib/x86_64-linux-gnu/libm-2.23.so
7fb86d047000-7fb86d246000 ---p 00108000 08:01 51646330 /lib/x86_64-linux-gnu/libm-2.23.so
7fb86d246000-7fb86d247000 r--p 00107000 08:01 51646330 /lib/x86_64-linux-gnu/libm-2.23.so
7fb86d247000-7fb86d248000 rw-p 00108000 08:01 51646330 /lib/x86_64-linux-gnu/libm-2.23.so
7fb86d248000-7fb86d3ba000 r-xp 00000000 08:01 24641724 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fb86d3ba000-7fb86d5ba000 ---p 00172000 08:01 24641724 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fb86d5ba000-7fb86d5c4000 r--p 00172000 08:01 24641724 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fb86d5c4000-7fb86d5c6000 rw-p 0017c000 08:01 24641724 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7fb86d5c6000-7fb86d5ca000 rw-p 00000000 00:00 0
7fb86d5ca000-7fb86e2cd000 r-xp 00000000 08:01 15993403 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_core3.so.3.3.1
7fb86e2cd000-7fb86e4cd000 ---p 00d03000 08:01 15993403 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_core3.so.3.3.1
7fb86e4cd000-7fb86e4d9000 r--p 00d03000 08:01 15993403 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_core3.so.3.3.1
7fb86e4d9000-7fb86e4ff000 rw-p 00d0f000 08:01 15993403 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_core3.so.3.3.1
7fb86e4ff000-7fb86e504000 rw-p 00000000 00:00 0
7fb86e504000-7fb86e595000 r-xp 00000000 08:01 15993400 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_rgbd3.so.3.3.1
7fb86e595000-7fb86e795000 ---p 00091000 08:01 15993400 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_rgbd3.so.3.3.1
7fb86e795000-7fb86e796000 r--p 00091000 08:01 15993400 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_rgbd3.so.3.3.1
7fb86e796000-7fb86e797000 rw-p 00092000 08:01 15993400 /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_rgbd3.so.3.3.1
7fb86e797000-7fb86e7bd000 r-xp 00000000 08:01 51646313 /lib/x86_64-linux-gnu/ld-2.23.so
7fb86e96c000-7fb86e975000 rw-p 00000000 00:00 0
7fb86e9ba000-7fb86e9bc000 rw-p 00000000 00:00 0
7fb86e9bc000-7fb86e9bd000 r--p 00025000 08:01 51646313 /lib/x86_64-linux-gnu/ld-2.23.so
7fb86e9bd000-7fb86e9be000 rw-p 00026000 08:01 51646313 /lib/x86_64-linux-gnu/ld-2.23.so
7fb86e9be000-7fb86e9bf000 rw-p 00000000 00:00 0
7ffcfb3fc000-7ffcfb41d000 rwxp 00000000 00:00 0 [stack]
7ffcfb41d000-7ffcfb41e000 rw-p 00000000 00:00 0
7ffcfb4dd000-7ffcfb4e0000 r--p 00000000 00:00 0 [vvar]
7ffcfb4e0000-7ffcfb4e2000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)**