本文介绍了图像投影的高采样率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的软件应该判断频谱带,并给定频段的位置,找到频段的峰值点和宽度。

My software should judge spectrum bands, and given the location of the bands, find the peak point and width of the bands.

我学会了和

import Image
from scipy import *
from scipy.optimize import leastsq

# Load the picture with PIL, process if needed
pic         = asarray(Image.open("band2.png"))

# Average the pixel values along vertical axis
pic_avg     = pic.mean(axis=2)
projection  = pic_avg.sum(axis=0)

# Set the min value to zero for a nice fit
projection /= projection.mean()
projection -= projection.min()


推荐答案

你想要什么要做的是。 Scipy有一个插值模块,为不同的情况提供了大量不同的函数,看看,或专门用于图像。

What you want to do is called interpolation. Scipy has an interpolate module, with a whole bunch of different functions for differing situations, take a look here, or specifically for images here.

是一个最近被问到的问题,它有一些示例代码,以及一个显示会发生什么的图表。

Here is a recently asked question that has some example code, and a graph that shows what happens.

但重要的是要认识到插值不会使您的数据更准确,因此在这种情况下它无法帮助您。

如果您想要更准确的结果,则需要更准确的数据。没有别的办法。您需要从更高分辨率的图像开始。 (如果您重新取样或插值,您的结果将 准确!)

If you want more accurate results, you need more accurate data. There is no other way. You need to start with a higher resolution image. (If you resample, or interpolate, you results will acually be less accurate!)

更新 - 问题已更改

@Hooked提出了一个很好的观点。考虑它的另一种方法是,不是立即平均(这会丢掉数据中的方差),而是可以从光谱图像中的每个水平行生成40个图形(如发布图像中的较低图形),所有这些图表将非常相似,但峰值位置,高度和宽度会有一些变化。您应该计算这40个图像中每个峰值中每个峰值的位置,高度和宽度,然后合并这些数据(匹配40个图形中的峰值),并使用适当的方差作为误差估计(峰值位置,高度)和(宽度),使用中心极限定理。这样您就可以充分利用数据。但是,我相信这是假设光谱图中每一行之间有一些独立性,这可能是也可能不是这样?

@Hooked has made a nice point. Another way to think about it is that instead of immediately averaging (which does throw away the variance in the data), you can produce 40 graphs (like your lower one in your posted image) from each horizontal row in your spectrum image, all these graphs are going to be pretty similar but with some variations in peak position, height and width. You should calculate the position, height, and width of each of these peaks in each of these 40 images, then combine this data (matching peaks across the 40 graphs), and use the appropriate variance as an error estimate (for peak position, height, and width), by using the central limit theorem. That way you can get the most out of your data. However, I believe this is assuming some independence between each of the rows in the spectrogram, which may or may not be the case?

这篇关于图像投影的高采样率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 14:57
查看更多