图像处理傅里叶变换图像变化_傅里叶变换和图像床单视图。
圖像處理傅里葉變換圖像變化
What do Fourier Transforms do? What do the Fourier modes represent? Why are Fourier Transforms notoriously popular for data compression? These are the questions this article aims to address using an interesting analogy to represent images.
傅立葉變換有什么作用? 傅立葉模式代表什么? 為什么眾所周知,傅立葉變換在數(shù)據(jù)壓縮方面很受歡迎? 這些是本文旨在使用有趣的類比表示圖像來(lái)解決的問(wèn)題。
Images are digital paintings. They are made up of different features. Some features require really precise control of the brush like drawing whiskers on a dog. Others can be quickly filled in with a thick brush, like a clear blue sky. All images are a combination of fine and dull features to varying degrees, i.e. high-frequency and low-frequency features.
圖像是數(shù)字繪畫。 它們由不同的功能組成。 一些功能需要真正精確地控制畫筆,例如在狗上繪制胡須。 其他人可以用濃密的刷子快速填充,例如湛藍(lán)的天空。 所有圖像在不同程度上都是精細(xì)特征和暗淡特征的組合,即高頻和低頻特征。
let’s take a moment to understand how frequencies crept up into our analysis. Imagine the sine wave over half a period. It slowly goes up reaches a maximum and then slowly diminishes. The higher the frequency of the sine, the narrower the wave.
讓我們花一點(diǎn)時(shí)間來(lái)了解頻率是如何爬升到我們的分析中的。 想象一下半個(gè)周期的正弦波。 它緩慢上升達(dá)到最大值,然后緩慢減小。 正弦頻率越高,波形越窄。
Photo by William Felker on Unsplash 威廉·費(fèi)爾克在Unsplash上的照片Imagine a cursed painter, who can only paint with brushes whose tips are half-wave sines. If he were to draw a delicately fine feature like the whiskers on a dog, he would choose a brush with a sine which has high frequency i.e. a narrowly pointed brush. Similarly, if he were to paint a clear sky that is devoid of any finer details, he would choose a brush with low frequency i.e. a fat thicker one.
想象一個(gè)被詛咒的畫家,他只能用筆尖是半波正弦的畫筆進(jìn)行繪畫。 如果要在狗身上畫出細(xì)微的特征(如胡須),他會(huì)選擇頻率較高的正弦畫筆,即窄尖的畫筆。 同樣,如果他要繪制沒(méi)有任何精細(xì)細(xì)節(jié)的晴朗天空,則他會(huì)選擇頻率較低的畫筆,即較厚的脂肪。
Higher the frequency, narrower the peaks.頻率越高,峰越窄。Surprisingly, all the images to ever exist are just like the artwork of the cursed painter. Notably, Fourier showed that every image (signal) can be decomposed into a range of sinuous terms where each term has a magnitude. The magnitudes are called Fourier coefficients. The whole process of decomposing an image into various sine terms and concomitantly their magnitudes is called Fourier decomposition. Fourier series is a much more general scenario, where the signals to be decomposed are periodic. Fourier Transforms are special cases where signals have an infinite time-period, i.e. non-periodic.
令人驚訝的是,所有存在的圖像都像被詛咒的畫家的作品一樣。 值得注意的是,傅立葉(Fourier)表明,每個(gè)圖像(信號(hào))都可以分解為一系列正弦項(xiàng),其中每個(gè)項(xiàng)都有一個(gè)大小。 幅度稱為傅里葉系數(shù)。 將圖像分解為各種正弦項(xiàng)及其幅度的整個(gè)過(guò)程稱為傅里葉分解。 傅立葉級(jí)數(shù)是一種更為通用的方案,其中要分解的信號(hào)是周期性的。 傅立葉變換是信號(hào)具有無(wú)限時(shí)間周期(即非周期性)的特殊情況。
One elegant and fast algorithm to do the above decomposition is the Fast Fourier Transform, which is arguably the most important algorithm to be developed in the 21st century. It has far-reaching applications in cellular communications, satellites, films, televisions, and much more.
快速傅立葉變換是完成上述分解的一種優(yōu)雅而快速的算法,它可以說(shuō)是21世紀(jì)最重要的算法。 它在蜂窩通信,衛(wèi)星,電影,電視等領(lǐng)域具有廣泛的應(yīng)用。
To visualize the sinuous nature of images, it would be interesting to plot the magnitude of an image as if it were a surface plot and observe the top view of the contours. This idea was developed by Dr. Steven Brunton at the University of Washington.
為了可視化圖像的彎曲性質(zhì),將圖像的大小繪制為表面圖并觀察輪廓的俯視圖將很有趣。 這個(gè)想法是華盛頓大學(xué)的史蒂文·布倫頓博士提出的。
The plot uses a photo by Jakob Kac on Unsplash.劇情使用雅各布? 凱克 ( Jakob Kac)在“ Unsplash”上的照片 。The sinuous nature of the image is clearly visible. the high-frequency features are sharply visible as narrow peaks. These include the eyes, the outlines of the facial structure, and the outline of the human hand. The low-frequency features, which are usually huge stretches of uniform color, are observed in the background. These include large regions of black colored fur and the background.
圖像的彎曲性質(zhì)清晰可見。 高頻特征清晰可見為窄峰。 這些包括眼睛,面部結(jié)構(gòu)輪廓和人手輪廓。 通常在背景中觀察到低頻特征,通常是巨大的均勻顏色延伸。 其中包括黑色毛皮和背景的大區(qū)域。
Here, is the simple code to replicate the prior results.
這是復(fù)制先前結(jié)果的簡(jiǎn)單代碼。
The source code to animate the surface plot is included in my Github, here!
我的Github中包含了動(dòng)畫曲面圖的源代碼, 在這里 !
This is called as the bed sheet view of the image. The idea behind the name is that if four people were holding each side of a bedsheet and begin oscillating it at one of the Fourier frequency with the corresponding magnitude and a similar setup with four people exists for each of the infinite Fourier modes, then the superposition of all the bedsheets would result physically in creases which look like the above image. Hence, the name, bed sheet view!
這稱為圖像的床單視圖。 該名稱背后的想法是,如果四個(gè)人拿著床單的每一側(cè),并開始以相應(yīng)的幅度以傅立葉頻率之一進(jìn)行振蕩,并且對(duì)于每個(gè)無(wú)限傅立葉模式都存在四個(gè)人的相似設(shè)置,則該疊加所有的床單都會(huì)在物理上導(dǎo)致皺紋,看起來(lái)像上面的圖像。 因此,名稱,床單視圖!
Okay, now that a good intuition is developed to understand what Fourier transforms can do, its a good exercise to go over these ideas formally. The Fourier decomposition equation for a discrete signal looks like:
好的,現(xiàn)在已經(jīng)發(fā)展出一種很好的直覺(jué)來(lái)理解傅立葉變換可以做什么,這是一個(gè)很好的練習(xí),可以正式地研究這些想法。 離散信號(hào)的傅立葉分解方程如下:
Here, xn is the value of the signal at time n. Xk is the Fourier coefficient for each frequency k. N is the total number of samples of the signal (i.e. the number of discrete time steps over which the signal was recorded). The FFT algorithm returns the Xk values for each frequency. The complex exponential can be decomposed into sines and cosines using the Euler’s formula. This provides a sanity check to the intuitions developed so far.
在此,xn是時(shí)間n處的信號(hào)值。 Xk是每個(gè)頻率k的傅立葉系數(shù)。 N是信號(hào)采樣的總數(shù)(即記錄信號(hào)的離散時(shí)間步長(zhǎng))。 FFT算法返回每個(gè)頻率的Xk值。 可以使用歐拉公式將復(fù)指數(shù)分解為正弦和余弦。 這為到目前為止開發(fā)的直覺(jué)提供了健全的檢查。
For example, let’s build a sinuous signal out of multiple frequencies. Say a combination of sines with 50, 100, and 200 hertz as frequencies and at different proportions. The periodic nature is still visible, but it is really hard to understand the original frequency components by visualizing the signal in the time domain.
例如,讓我們從多個(gè)頻率構(gòu)建一個(gè)正弦信號(hào)。 說(shuō)出頻率分別為50、100和200赫茲的正弦組合。 周期性仍然是可見的,但是通過(guò)在時(shí)域中可視化信號(hào)很難理解原始頻率分量。
The Fourier Transform helps to intuitively visualize the signals in the frequency domain. So, applying the Fourier decomposition on the above signal gives us the following plot.
傅立葉變換有助于直觀地可視化頻域中的信號(hào)。 因此,對(duì)上述信號(hào)進(jìn)行傅立葉分解可得出以下曲線。
The true frequencies of the mixture at 50, 100, and 200 Hz show peaks in the frequency domain as expected. Notably, the FFT algorithm can also give the weightage of each frequency component, without having any prior knowledge of the signal.
混合物在50、100和200 Hz的真實(shí)頻率如預(yù)期的那樣在頻域中顯示出峰值。 值得注意的是,FFT算法還可以給出每個(gè)頻率分量的權(quán)重,而無(wú)需事先了解信號(hào)。
Ah, yes! the notorious one line FFT command. In MATLAB, it’s even simpler, just fft() without any imports.是的! 臭名昭著的單行FFT命令。 在MATLAB中,它甚至更簡(jiǎn)單,只是沒(méi)有任何導(dǎo)入的fft()。Now going back to the bedsheet view of images, every picture is a 2-dimensional signal on which the Fourier decomposition can be applied. If a slice of the image is taken, it would resemble the time domain signal from our example, however with its own frequency components. The bedsheet views are powerful to develop intuition behind how an image can be a simple signal in the time domain, with multiple dimensions.
現(xiàn)在回到圖像的床單視圖,每張圖片都是一個(gè)二維信號(hào),可以對(duì)其進(jìn)行傅立葉分解。 如果拍攝圖像的一部分,它將類似于我們示例中的時(shí)域信號(hào),但是具有自己的頻率分量。 床單視圖功能強(qiáng)大,可以直觀地理解圖像在時(shí)域中如何成為具有多個(gè)維度的簡(jiǎn)單信號(hào)。
In general, the information-dense regions are made up of high-frequency terms and plain stretches of uniformity are made up of lower frequency terms. The genius of Fourier is deriving the weighted modes (or frequency — magnitude pair). This gives an idea to understand the most important modes which make up the image. Turns out the Pareto rule holds true here and a really small number of modes contain most of the information about the image. This principle is crucial to data compression. By ignoring the majority of modes, we could reduce the size of the image. However, the quality of the image is only slightly compromised.
通常,信息密集區(qū)域由高頻項(xiàng)組成,均勻性的平坦范圍由低頻項(xiàng)組成。 傅立葉的天才在于推導(dǎo)加權(quán)模式(或頻率-幅度對(duì))。 這給出了一個(gè)了解構(gòu)成圖像的最重要模式的想法。 事實(shí)證明,帕累托規(guī)則在這里成立,很少有模式包含有關(guān)圖像的大多數(shù)信息。 該原理對(duì)于數(shù)據(jù)壓縮至關(guān)重要。 通過(guò)忽略大多數(shù)模式,我們可以減小圖像的大小。 但是,圖像的質(zhì)量只會(huì)略有下降。
If you are interested in going more in-depth on how Fourier Transforms are used for data compression, or to understand why data is compressible, to begin with, check out my previous article. As always, reach out to me to continue the conversation or provide me with some feedback on the content.
如果您想更深入地了解如何使用傅里葉變換進(jìn)行數(shù)據(jù)壓縮,或者想了解為什么數(shù)據(jù)是可壓縮的,那么請(qǐng)閱讀我的上一篇文章 。 與往常一樣,請(qǐng)與我聯(lián)系以繼續(xù)對(duì)話或向我提供有關(guān)內(nèi)容的反饋。
翻譯自: https://towardsdatascience.com/fourier-transforms-and-bed-sheet-view-of-images-58ba34e6808a
圖像處理傅里葉變換圖像變化
總結(jié)
以上是生活随笔為你收集整理的图像处理傅里叶变换图像变化_傅里叶变换和图像床单视图。的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 女人做梦梦到我什么意思
- 下一篇: 滞后分析rstudio_使用RStudi