测量图像中迹线的平均厚度 [英] Measuring the average thickness of traces in an image
问题描述
这里的问题:我有一些由不同厚度的痕迹组成的二进制图像。下面有两个图片来说明问题:
第一张图片 - 大小:711 x 643 px
img src =https://imgur.com/bA263.pngalt =711 x 643示例图片>
第二图片 - 大小:930 x 951像素
我需要的是测量图像中轨迹的平均厚度(以像素为单位)。事实上,图像中迹线的平均厚度是一种主观测量。因此,我需要的是一个与跟踪半径有一定相关性的度量,如下图所示:
备注
-
由于度量不需要非常精确,我愿意交易精度的速度。换句话说,速度是解决这个问题的重要因素。
-
痕迹可能有交叉。
-
轨迹厚度可能不是恒定的,但平均测量是正确的(即使最大轨迹厚度是可以接受的)。
- 以便所有背景像素都设置为0,所有前景像素都设置为离背景的距离。
- 在距离变换图像中查找局部最大值。这些是在线的中间的点。将它们的像素值(即背景距离)图像列入列表
- 计算该列表的中值或平均值
Since the measure doesn't need to be very precise, I am willing to trade precision for speed. In other words, speed is an important factor to the solution of this problem.
There might be intersections in the traces.
The trace thickness might not be constant, but an average measure is OK (even the maximum trace thickness is acceptable).
The trace will always be much longer than it is wide.
- Apply a distance transformation to the image, so that all background pixels are set to 0, all foreground pixels are set to the distance from the background
- Find the local maxima in the distance transformed image. These are points in the middle of the lines. Put their pixel values (i.e. distances from the background) image into a list
- Calculate the median or average of that list
我建议使用这种算法:
Here's the problem: I have a number of binary images composed by traces of different thickness. Below there are two images to illustrate the problem:
First Image - size: 711 x 643 px
Second Image - size: 930 x 951 px
What I need is to measure the average thickness (in pixels) of the traces in the images. In fact, the average thickness of traces in an image is a somewhat subjective measure. So, what I need is a measure that have some correlation with the radius of the trace, as indicated in the figure below:
Notes
I'd suggest this algorithm:
这篇关于测量图像中迹线的平均厚度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!