是否可以使用逆距离变换?

时间:2019-05-31 09:40:22

标签: opencv image-processing computer-vision

我有一个输入的岩石深度图像,必须对其进行分割。我发现了一种检测边缘的好方法。我想应用分水岭算法来分割岩石。我现在需要应用距离变换才能知道到边缘的距离。但是结果并不如预期。

我尝试了opencv提供的各种其他选项,包括CV_DIST_FAIR,CV_DIST_WELSCH。

但是我需要与距离变换相反的东西,以显示岩石内部的最高强度。我可以将其用作标记。

// Tried to inverse the binary but that doesn't work
//cv::bitwise_not(cannyedge_detected_image, cannyedge_detected_image);

// Finding the distance to the boundaries
cv::Mat distance_transformed_image, dst_distance_transform;
cv::distanceTransform(cannyedge_detected_image, distance_transformed_image, CV_DIST_L2, 3);
cv::normalize(distance_transformed_image, distance_transformed_image, 0, 1., cv::NORM_MINMAX);
cv::resize(distance_transformed_image, dst_distance_transform, cv::Size(image.cols * 3, image.rows * 3));
cv::imshow("Distance Transform", dst_distance_transform);
cv::waitKey(200);

结果如下: enter image description here

0 个答案:

没有答案