英文:
How to Normalize Image
问题
我正在进行一个工作,在这个工作中,我需要根据模型和信号创建一幅图像,这些图像分别是信号1和信号2的结果:
但理想情况下,我需要得到类似这样的结果:
我也接受其他方法或图像处理来获得这样的结果。
我尝试了一些基本的归一化方法,但我能得到的最好结果是这个:
仍然有一些噪音。
提前感谢。
英文:
I'm doing a job where I need to create an image from a model and signal, and I have these images as the result for signal 1 and 2, respectively:
But ideally I need to get something like this:
I'm also accepting other methods or image processing to get the result.
I tried some basic normalization methods, but the better I could get is this:
that still has some noise.
Thanks in advance.
答案1
得分: 0
假设您的所有图像在信号强度方面都具有相同的自顶向下梯度,且在水平方向上具有恒定的响应,那么您可以使用类似以下的方法来规范化响应(伪代码,因为我尝试了一些与Python和OpenCV不同的东西,应该很容易复制这个过程):
M = max(img, axis=1) # 每行的最大值
M = dilation(M, 15) # 每个最大值都有更大的范围
img = img / M # 为最大强度规范化每一行
output = img > 0.5 # 一些固定阈值
在规范化之后,固定的阈值能够轻松提取每个局部最大值。
在膨胀中的15(注意此时的M
是一个1D数组)将是1D结构元素的长度。这应该足够大,以覆盖行之间的间隙,对于第一个示例来说,5应该足够,而第二个示例可能需要10。
这里的想法是,如果您不知道每行上点的间距有多接近,那么逐行规范化会更容易实现。这个操作相当于在图像上应用一个结构元素,它的高度为15个像素,宽度为无限。
英文:
Assuming all your images have the same top-down gradient in the signal strength, with a constant response horizontally, then you can normalize the response using something like this (psuedo-code, because I experimented with something other than Python and OpenCV, it should be easy to replicate this):
M = max(img, axis=1) # the maximum value of each row
M = dilation(M, 15) # each maximum has a larger reach
img = img / M # normalize each row for the maximum intensity
output = img > 0.5 # some fixed threshold
After the normalization, the fixed threshold was able to extract each of the local maxima easily.
The 15 in the dilation (note that M
is a 1D array at this point) would be the length of the 1D structuring element. This should be large enough to cover the gaps between the rows, 5 should be enough for the first example, the second needs maybe 10.
The idea here is that the row-wise normalization is easier to accomplish if you don't know how closely together the dots are on each row. This operation would be equivalent to applying a dilation to the image using a structuring element that is 15 pixels high and infinitely wide.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论