图像投影的高采样率 [英] Higher sampling for image's projection

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

问题描述

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

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

我学会了投影图像

I learned to take the projection of the image and to find width of each peak.

但我需要更好的方法来查找投影

我使用的方法将1600像素宽的图像(例如1600X40)缩小为1600长的序列。理想情况下,我希望使用相同的图像将图像缩小为10000个长的序列。

The method I used reduces a 1600-pixel wide image (eg 1600X40) to a 1600-long sequence. Ideally I would want to reduce the image to a 10000-long sequence using the same image.

我想要更长的序列,因为1600点也提供低分辨率。单个点会导致较大的差异(如果从18到19判断一个波段,则存在4%的差异)。

I want a longer sequence as 1600 points provide too low resolution. A single point causes a large difference (there is a 4% difference if a band is judged from 18 to 19) to the measure.

如何从同一张图片中获得更长投影?

How do I get a longer projection from the same image?

代码我用过: https://stackoverflow.com/a/9771560/604511

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?

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆