1
\$\begingroup\$

I saw similar question and several good answers at here

What does "frequency" mean in an image?

but, I actually couldn't understand about those answers. "Is it right that the higher the frequency, the more detail that picture is?"

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Please see How Do I “Refresh” a Question? \$\endgroup\$
    – mattdm
    Commented Oct 24, 2019 at 13:27
  • \$\begingroup\$ I couldn't see an answer that I could understand at similar question so I questioned again what I was curious about \$\endgroup\$ Commented Oct 28, 2019 at 8:13

1 Answer 1

1
\$\begingroup\$

I will try to explain with the simplest math terms possible. If you want to skip the math, jump to part II, if you want to get the short answer skip to Part III

Part I

Frequency of a signal means the number of occurrences of a repeating event per unit of time. So if the unit of time is seconds then frequency is measured with Herz: 1Hz = 1/s. So a signal with 100Hz, has a pattern that repeats 100 times per second.

The most basic signal (from the point of view of signal processing) is a sinus signal.

y(t) = sin(2πft)

where f is the frequency of this sinus signal, and t is time. If this signal was sound and f was around 50Hz, you will hear one very low bass tone. with a higher frequency like 15kHz it will be a higher tone.

Now to generalise the concept, the signal could be a spacial signal, instead of a temporal signal... as if you draw the sinus wave on a piece of paper, with an axis called x pointing to the right, and the y axis perpendicular to the x axis.

y(x) = sin(2πfx)

where f is the frequency of the signal, and x is the spacial variable. f here is not measured with 1/s anymore, but 1/(unit of space).

Fourier a French mathematician showed that you can generate any signal by adding a number of sine and cosine signals with different amplitudes and frequencies. That is called Fourier Analysis.

Using Fourier analysis it is possible to write any function y(x) as a sum of sine and cosine signals with different frequencies, so a function y(x) can be rewritten in terms of several functions related to frequency Y(f). One can say that y(x) = Some_Function( Y(f) ). or Y(f)=Reverse_of_Some_Function(y(x))

The Fourier Transformation is the function F that transform a signal from the x domain, to the frequency domain.

Y(f) = F( y(x) )

y(x) = F_inv(Y(f))

F is an analogue function, Discrete Fourier Transformation DFT is the numerical approximation of F. Fast Fourier Transformation FFT is a way to do DFT optimised for speed.

Ok...

Part II

Now computer images are composed of pixels, and every pixel have an intensity value for Red, Green, Blue aka RGB values. In grayscale images the intensity for R, G, B of any pixel are equal, R=G=B=I so we can talk about I for grayscale images.

The 800px X 100px grayscale picture below was generated using I(x) = sin(2πfx) where f = 1 repetition/800px = 0.00125 repetition/px

enter image description here

You can generate it yourself with Python3

from PIL import Image, ImageDraw
from math import sin, pi

img = Image.new('RGB', (800,100), color='black')
draw = ImageDraw.draw(img)

#cacluate the frequency
n = 10 #repetitions
f = n/img.width #

#iterate of the width pixels
for x in range(img.width):
 #calculate the intensity i in that pixel x
 y = sin(2*pi*f*x - pi/2) #this will generate values between -1 and +1, -pi/2 is to make sure that i starts with value 0 in the next line.
 i = (255+255*y)/2 #shifting and scaling y so that the values are between 0 and 255
 draw.line((i,0,i,img.height), fill=(int(i),int(i),int(i)))

img.show()

The 800px X 100px grayscale picture below was generated using I(x) = sin(2πfx) where f = 10repetitions/800px = 0.0125 repetitions/px

enter image description here

Now it is easy to see that this image has a horizontal frequency of 10. Let's increase the frequency by a factor of 10, so that n = 100. f = 100/800 = 1/8 = 0.125 repetitions/px:

enter image description here

As mentioned earlier, you can represent any signal (1D grayscale image) as a sum series of sine signals (1D grayscale sine images) with different frequencies.

Part III

So a 1D grayscale image A has higher frequencies than another grayscale image B if A has "finer" details.

You can generalise that principle to colored 2D, 3D images. The finer the "details" of an image are the higher the frequency content of that image is.

So a blue sky is low frequency in comparison with an image of a flower.

You can learn more about this by reading about Fourier Analysis, and about Digital Image Processing.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.