【发布时间】:2017-02-15 22:36:10
【问题描述】:
使用这个简单的独立演示:
#include <opencv2/opencv.hpp>
#include <iostream>
int main(int argc, char *argv[]) {
// unsigned char data[] = {1, 0, 1}; // crashes
unsigned char data[] = {1, 1, 0}; // does not crash
cv::Mat1b testImage = cv::Mat1b(3, 1, data);
cv::Mat labeledImage;
cv::Mat stats;
cv::Mat centroids;
int neighborhood = 8;
int componentCount = cv::connectedComponentsWithStats(
testImage, labeledImage, stats, centroids, neighborhood);
std::cout << "componentCount: " << componentCount << std::endl;
return EXIT_SUCCESS;
}
使用 gcc 5.4 它适用于两个“数据”值。使用 gcc 6.2,它适用于 {1,1,0},但使用 data = {1,0,0} 转储它:
======= Memory map: ========
00400000-00407000 r-xp 00000000 08:01 15214967 /home/doria/build/Examples/c++/OpenCV/Bug/Bug
00606000-00607000 rw-p 00006000 08:01 15214967 /home/doria/build/Examples/c++/OpenCV/Bug/Bug
020b2000-0216c000 rw-p 00000000 00:00 0 [heap]
7f2608000000-7f2608021000 rw-p 00000000 00:00 0
7f2608021000-7f260c000000 ---p 00000000 00:00 0
7f260cc1d000-7f260cc24000 r-xp 00000000 08:01 10883576 /lib/x86_64-linux-gnu/librt-2.23.so
7f260cc24000-7f260ce23000 ---p 00007000 08:01 10883576 /lib/x86_64-linux-gnu/librt-2.23.so
7f260ce23000-7f260ce24000 r--p 00006000 08:01 10883576 /lib/x86_64-linux-gnu/librt-2.23.so
7f260ce24000-7f260ce25000 rw-p 00007000 08:01 10883576 /lib/x86_64-linux-gnu/librt-2.23.so
7f260ce25000-7f260ce28000 r-xp 00000000 08:01 10883446 /lib/x86_64-linux-gnu/libdl-2.23.so
有什么想法吗?
【问题讨论】:
-
嗨大卫!我想我发现了这个错误。我会给算法的作者发一封电子邮件,看看他是否有进一步的见解