我想在 C++ 中实现 matlab 的 imhmin() 函数。首先,我检查了算法。它抑制最小像素强度值。非最大抑制码为:
void non_maxima_suppression(const cv::Mat& src, cv::Mat& mask, const bool remove_plateaus)
{
// find pixels that are equal to the local neighborhood not maximum (including 'plateaus')
cv::dilate(src, mask, cv::Mat());
cv::compare(src, mask, mask, cv::CMP_GE);
// optionally filter out pixels that are equal to the local minimum ('plateaus')
if (remove_plateaus) {
cv::Mat non_plateau_mask;
cv::erode(src, non_plateau_mask, cv::Mat());
cv::compare(src, non_plateau_mask, non_plateau_mask, cv::CMP_GT);
cv::bitwise_and(mask, non_plateau_mask, mask);
}
}
imhmin() 函数返回抑制值。但是,非最大抑制返回二进制值。我该如何处理?