一维边缘检测
我不想对 2D 图像进行边缘检测,而是想分别检测图像的每一行(即一条线)上的边缘。即从输入 1D 向量检测边缘,其值是范围从 0 到 255 的像素强度(下图):
我想检测示例输入中出现的主要边缘(下图)
Instead of edge detection of a 2D image, I would like to detect edges on every single row (i.g. a line) of an image separately. That is detection of edges from an input 1D vector whose values are pixel intensities ranging from 0 to 255 ( image below):
I would like to detect the major edges as appear in the sample input( image below)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
获得所需结果的一种方法是按如下方式调整 2D Canny 边缘检测器(Mathematica 中的代码):
首先,使用高斯导数滤波器计算空间导数,设置相对于您想要的边缘比例的 sigma 值探测。取结果的绝对值。
然后,自动确定阈值以将先前的导数值聚类为两组(此处使用大津方法)。
然后,检测导数值的步长(进入/离开“死区”的转换)。
此时,您已经有了边缘的末端:
可选 - 看来这就是您想要的--仅保留边缘的最低端。在这种情况下,将边缘末端的数据点聚类是可行的,但我不确定它的鲁棒性如何。
One way to get to your desired result is to adapt the 2D Canny edge detector as follows (code in Mathematica):
First, compute the spatial derivative using a Gaussian derivative filter, setting the sigma value relative to the scale of the edges you want to detect. Take the absolute value of the result.
Then, determine a threshold automatically to cluster the previous derivative values in two groups (here using Otsu's method).
Then, detect the steps of the derivative values (transitions into/from the "dead band").
At this point you have the ends of the edges:
Optionally--it seems that's what you'd like--keep only the lowest ends of the edges. Clustering the data points at the ends of the edges works in this case, but I'm not sure how robust it is.
考虑到这些边缘的良好对比度,有一个简单且可靠的解决方案:检测所有单调的像素值序列(严格增加或减少)。您将保持序列的总高度高于阈值(在您的情况下为 50),以拒绝噪声峰值。
作为副产品,您将获得起点和终点(虽然不完全是您期望的位置,但如果需要,可以对其进行改进)。
条形码?
Given the nice contrast of these edges, there is an easy solution that will work robustly: detect all monotonous sequences of pixel values (strictly increasing or decreasing). You will keep the sequences having a total height above a threshold (50 in your case) to reject the noisy peaks.
As a byproduct, you'll get the starting and ending points (not exactly where you expect them though, but this can be improved on if needed).
Barcodes ?
那么您正在寻找斜率的特定变化 - 即每个样本 Y 的特定变化?
难道不是简单地查看两个样本之间 Y 的差异,如果它的绝对值变化超过某个限制,则将其标记为边缘?
So you are looking for a particular change in slope - ie a certain change in Y per sample?
Isn't it simply look at the difference in Y between two samples and if it's absolute value changed by more than some limit mark that as an edge?