FidMTF: An MTF Estimator (FidMTF:一种MTF估计方法)

目录

Author's Notes 作者笔记

Introduction 介绍

Algorithm Description 算法描述

First Edge Position Estimation 第一边缘位置估计

The MTF Class MTF类

Definitive Edge Location 确定边缘位置

ESF and PSF Estimation (ESF和PSF估计)

MTF Estimation MTF估算

The Edge Class (Edge类)

Validation 验证

Installing and Using as a QGIS Plugin 安装并用作QGIS插件


Robust ESF, PSF, FWHM & MTF estimation from low-quality images and synthetic edge creation.

从低质量图像和合成边缘创建鲁棒ESF、PSF、FWHM和MTF估计。

Author's Notes 作者笔记

Estimating the MTF becomes difficult when the image is far from ideal, something that often happens with satellite data. I came up with the idea of using piecewise polynomials and optimization techniques to build a robust MTF estimator that doesn't rely on a given function and, being mostly numerical, is also more empiric.

当图像很不理想(译注:画质不好),估计MTF就变得很困难,卫星数据经常发生这种情况。我想到用分段多项式和优化技术来建立一个稳健的MTF估计器,它不依赖于给定的函数,而且主要是数值的,也更经验性。

Implementing this algorithm using Python and its numeric and scientific packages was a funny exercise. Surprisingly, it works pretty fine. I think it is robust, as expected, but it is also accurate. I validated it against third-party software. So it is maybe somewhat valuable. For this reason I've decided to open-source it using a GPLv3.0 license.

使用Python及其数字和科学包实现此算法是一个有趣的练习。令人惊讶的是,它工作得相当好。我认为它是稳健的,正如预期,但它也是准确的。我用第三方软件验证了它。所以它可能有点价值。因此,我决定使用GPLv3.0许可证来分享源代码。

Introduction 介绍

The Modulation Transfer Function (MTF) of an optical system represents the spatial frequency performance of such system. Its behaviour is directly related to the concepts of sharpness, contrast and spatial resolution. For this reason it is an important quality indicator, hence the need of an estimation method. The MTF can be inferred from the optical system design but, unfortunately, in the real world only its modulus can be empirically determined or measured from the actual system.

光学系统的调制传递函数(MTF)反映了光学系统的空间频率特性。它的行为与锐度、对比度和空间分辨率的概念直接相关。因此,它是一个重要的质量指标,因此需要一个估计方法。MTF可以从光学系统的设计中推断出来,但不幸的是,在现实世界中,只有其模量可以通过经验确定或从实际系统中测量。

One way to perform the estimation is to use actual images produced by the system. For example, the ISO 12233 provides an estimation standard focused on still picture cameras using test charts or standardized targets. There are multiple ways of estimating the MTF using images, all of them based on the same idea: Extracting spatial frequency performance information beyond the discrete values that the image directly provides.

执行估计的一种方法是使用系统生成的实际图像。例如,iso12233提供了使用测试图卡或标准化目标聚焦于静止图像相机的估计标准。利用图像估计MTF有多种方法,它们都基于相同的思想:提取图像直接提供的离散值之外的空间频率性能信息。

The Slanted-Edge methodology is an astute way of doing this. It uses a tilted knife-edge image and assumes that the transition between the two zones is straight and sharp in the object space. Under these assumptions it is then possible to estimate the sub-pixel position of the edge. Due to the knife-edge inclination it is then feasible to map multiple sub-pixel estimates that can be used to build a statistically robust model of the edge in the image space. This edge model can be immediately converted into a Point Spread Function (PSF) from which the MTF can be estimated.

斜边方法是一种精明的方法。它使用倾斜的刀口图像,并假设两个区域之间的过渡在对象空间中是直的和尖锐的。在这些假设下,可以估计边缘的亚像素位置。由于刀口倾斜,因此映射多个子像素估计是可行的,可用于在图像空间中建立边缘的统计稳健模型。这种边缘模型可以立即转换为点扩展函数(PSF),从中可以估计MTF。

Algorithm Description 算法描述

The algorithm implemented here is based on the slanted-edge sub-pixel sampling concept. I will describe it step by step following a real world example: An image acquired by an Earth-observation satellite on the Baotou Comprehensive Calibration and Validation Site.

这里实现的算法是基于倾斜边缘亚像素采样的概念。我将按照一个现实世界的例子一步一步地描述它:一个地球观测卫星在包头综合校准和验证站点获取的图像。

Baotou target
 

Currently the algorithm requires the pixels outside the target to be set to zero. Note that the target has two dark areas with different gray levels. The algorithm will use both, automatically recognizing when the transition goes from bright to dark or vice-versa. Only the edge closest to the vertical will be used. There won't be enough pixels near the center to obtain a reliable edge model, those will be automatically discarded.

目前,该算法要求将目标外的像素设置为零。请注意,目标有两个灰度不同的暗区。该算法将同时使用这两种方法,自动识别从亮到暗的过渡或从亮到暗的过渡。只使用最接近垂直面的边。中心附近没有足够的像素来获得可靠的边缘模型,这些像素将被自动丢弃。

Baotou features

The algorithm will also work with simple edge images.

该算法也适用于简单的边缘图像。

First Edge Position Estimation 第一边缘位置估计

The Transect class represents an image row. It contains the method needed to estimate the sub-pixel position of the edge in the represented row. For robustness the class requires a minimum number of data pixels in total and around the edge to be valid (__isValid).

横断类表示图像行。它包含了边缘评估行中的子像素位置所需的方法。为了保持健壮性,类需要在围绕边缘的一些数据像素数才能有效(__isValid)。

The row data is first smoothed and then differentiated to obtain a coarse estimation of the pixel position of the edge. The estimation is used later to set the initial conditions of the optimization that fits a Sigmoid function to the data. The optimization technique used allows you to easily set a different function if you are not comfortable with the Sigmoid modelling the Edge Spread Function (ESF). It is worth noting that the Sigmoid won't be used for the MTF calculation, it is only used for the estimation of the sub-pixel edge position.

首先对行数据进行平滑,然后进行差分,以获得边缘像素位置的粗略估计。该估计稍后用于设置优化的初始条件,以使数据符合Sigmoid函数。如果您对Sigmoid建模边缘扩展函数(ESF)不满意,使用的优化技术可以轻松设置不同的函数。值得注意的是,Sigmoid不会用于MTF计算,它只用于亚像素边缘位置的估计。

The optimization yields the function parameters, allowing us to work in a continuous domain. From here it is trivial to obtain the function derivative (Line Spread Function, LSF) and its inflection point, which corresponds to the estimated sub-pixel position of the edge.

优化得到函数参数,使我们能够在连续域中工作。由此很容易得到与边缘估计的亚像素位置相对应的函数导数(线扩展函数,LSF)及其拐点。

Sigmoid fitted to row data in a specific Transect. The red marker shows the estimated sub-pixel edge position. Circles are pixel values.
Sigmoid符合特定横断面的行数据。红色标记显示估计的亚像素边缘位置。圆圈是像素值。

The MTF Class MTF类

When instantiated, the class scans the image row by row creating transect instances. If the edge detection is not good enough (short transect, unreliable edge data, etc.) the transects are labeled as invalid and no longer used.

实例化时,该类逐行扫描图像,创建横断面实例。如果边缘检测不够好(样条短、边缘数据不可靠等),则样条被标记为无效,不再使用。

The method refineEdgeSubPx() performs a linear regression in order to check if the centers arrangement is straight as assumed. Outliers are removed during this process. The second run of this method allows the estimation of the edge angle.

方法refineEdgeSubPx()执行线性回归,以检查中心排列是否与假设的直线一致。在此过程中将删除异常值。该方法的第二次运行允许估计边缘角度。

Estimated sub-pixel edge locations of valid transects. The resulting line of the linear regression is shown in red.
有效断面的估计亚像素边缘位置。线性回归的结果线以红色显示。

Definitive Edge Location 确定边缘位置

Each transect has a sub-pixel edge position estimated using a function fitting. It has served its purpose and won't be used any longer. The definitive sub-pixel edge position of each transect is now defined by the resulting line of the second iteration of the linear regression (refineEdgeSubPx(), outliers removed).

每个横断面都有一个使用函数拟合估计的亚像素边缘位置。它已经达到了目的,不再使用了。现在,通过线性回归第二次迭代(refineEdgeSubPx()移除离群值)的结果行定义每个横断面的最终子像素边缘位置。

ESF and PSF Estimation (ESF和PSF估计)

The sub-pixel edge position is used to shift each transect to a common origin, hence creating a supersampled virtual edge. This way, instead of using the Sigmoid or other function, the edge is modelled as a spline, creating a numeric and more realistic representation of the ESF. The PSF is obtained by fitting the spline shape to a Gaussian function using a Levenberg-Marquardt optimization(calcOptimizedLsf).

子像素边缘位置用于将每个横断面移动到公共原点,从而创建超采样虚拟边。这样,边不是使用Sigmoid或其他函数,而是将边建模为样条曲线,从而创建ESF的数值和更真实的表示。通过采用Levenberg-Marquardt优化(calcOptimizedLsf)将样条曲线形状拟合到高斯函数,得到了PSF。

Green: Supersampled edge 绿色:超级采样边缘
Brown: Best-fit Gaussian resulting from the optimization 棕色:最佳拟合高斯优化结果
Red: Optimized ESF spline numeric model 红色:优化的ESF样条数值模型
Blue: Optimized PSF spline numeric model 蓝色:优化PSF样条数值模型

MTF Estimation MTF估算

The MTF is now straightforward to calculate from the optimized PSF numeric model using the real and discrete fast Fourier transform implemented in the NumPy package.

MTF现在可以直接从优化的PSF数值模型中使用在NumPy包中实现的实离散快速傅里叶变换进行计算。

The results are provided through a Matplotlib interactive widget with additional information on the console.

结果是通过Matplotlib交互式widget提供的,控制台上还有其他信息。

Matplotlib output example
Matplotlib输出示例
Console output example
控制台输出示例

The Edge Class (Edge类)

This class is intended for validation purposes. You can use it to create perfect synthetic edges for performance comparison with third-party software.

此类用于验证目的。您可以使用它创建完美的合成边缘,以便与第三方软件进行性能比较。

Synthetic edge sample
合成边缘示例

Validation 验证

The algorithm and its implementation has been validated using synthetic edges and actual edges using third-party software.

利用第三方软件,利用合成边和实际边缘对算法进行了验证。

Installing and Using as a QGIS Plugin 安装并用作QGIS插件

Check the instructions. 检查说明书。

原文:MTF_Estimator/Algorithm_Description.md at master · JorgeGIlG/MTF_Estimator · GitHub

代码:GitHub - JorgeGIlG/MTF_Estimator: Robust ESF, PSF, FWHM & MTF estimation from low quality images.

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值