Mahotas 简明教程

Mahotas - Wavelet Transforms

小波变换是一种将图像分解为不同的频率分量的数学技术。小波变换可以捕获图像的局部和全局细节。

Wavelet transforms are mathematical techniques used to break the images into different frequency components. Wavelet transforms captures both the local and the global details of an image.

小波变换使用被称为小波的小波形函数来分析信号。这些小波缩放和变换以匹配图像中存在不同的模式。

Wavelet transforms use small wave−shaped functions, known as wavelets, to analyze signals. These wavelets are scaled and transformed to match different patterns present in an image.

小波变换涉及修改频率分量的高频和低频系数,以产生识别模式和增强图像。原始图像可以通过逆转小波变换来恢复。

Wavelet transform involves modifying the high and low frequency coefficients of the frequency components to produce identify patterns and enhance and image. The original image can be recovered by inversing the wavelet transform.

让我们讨论小波变换技术及其逆变化。

Let us discuss about the wavelet transformation techniques along with their inverse variations.

Daubechies Transformation

Daubechies 变换是一种小波变换技术,用于将信号分解为不同的频率分量。它使我们能够同时在时域和频域中分析信号。

The Daubechies transformation is a wavelet transformation technique used to break a signal into different frequency components. It allows us to analyze the signals in both the time and the frequency domains.

让我们在下面看到 Daubechies 变换图像 −

Let’s see Daubechies transformation image below −

daubechies transformation

Inverse Daubechies Transformation

逆 Daubechies 变换是 Daubechies 变换的反向过程。它通过 Daubechies 变换获得的各个频率分量重建原始图像。

The inverse Daubechies transformation is the reverse process of the Daubechies transformation. It reconstructs the original image from the individual frequency components, which are obtained through the Daubechies transformation.

通过应用逆变换,我们可以在保留重要细节的同时恢复信号。

By applying the inverse transform, we can recover the signal while preserving important details.

这里,我们看看 Daubechies 变换的逆 −

Here, we look at inverse of Daubechies transformation −

inverse daubechies transformation

Haar Transformation

Haar 变换技术通过将图像划分为子区域将其分解为不同的频率分量。然后,它计算平均值之间的差异以对图像应用小波变换。

The Haar transformation technique breaks down an image into different frequency components by dividing it into sub−regions. It then calculates the difference between the average values to apply wavelet transformation on an image.

在下面的图像中,我们看到变换的 Haar 图像 −

In the image below, we see the Haar transformed image −

haar transformation

Inverse Haar

逆 Haar 变换通过 Haar 变换获得的频率分量重建原始图像。它是 Haar 变换的反向操作。

The inverse Haar transformation reconstructs the original image from the frequency components obtained through the Haar transformation. It is the reverse operation of the Haar transformation.

让我们看看 Haar 变换的逆 −

Let’s look at inverse of Haar transformation −

inverse haar

Example

在下面的示例中,我们将尝试执行上面解释的所有小波变换−

In the following example, we are trying to perform all the above explained wavelet transformations −

import mahotas as mh
import numpy as np
import matplotlib.pyplot as mtplt
image = mh.imread('sun.png', as_grey=True)
# Daubechies transformation
daubechies = mh.daubechies(image, 'D6')
mtplt.imshow(daubechies)
mtplt.title('Daubechies Transformation')
mtplt.axis('off')
mtplt.show()
# Inverse Daubechies transformation
daubechies = mh.daubechies(image, 'D6')
inverse_daubechies = mh.idaubechies(daubechies, 'D6')
mtplt.imshow(inverse_daubechies)
mtplt.title('Inverse Daubechies Transformation')
mtplt.axis('off')
mtplt.show()
# Haar transformation
haar = mh.haar(image)
mtplt.imshow(haar)
mtplt.title('Haar Transformation')
mtplt.axis('off')
mtplt.show()
# Inverse Haar transformation
haar = mh.haar(image)
inverse_haar = mh.ihaar(haar)
mtplt.imshow(inverse_haar)
mtplt.title('Inverse Haar Transformation')
mtplt.axis('off')
mtplt.show()

Output

获得的输出如下所示 −

The output obtained is as shown below −

Daubechies Transformation:

Daubechies Transformation:

daubechies transformation1

Inverse Daubechies Transformation:

Inverse Daubechies Transformation:

inverse daubechies transformation1

Haar Transformation:

Haar Transformation:

haar transformation1

Inverse Haar Transformation:

Inverse Haar Transformation:

inverse haar1

我们将在剩下的章节中详细讨论所有小波变换。

We will discuss about all the wavelet transformations in detail in the remaining chapters.