Commit 0736a589 authored by Alok Bharadwaj's avatar Alok Bharadwaj

Added some text to the Jupyter Notebooks

parent 185065e2
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,6 +6,14 @@
"source": [
"# Introduction to Image Processing\n",
"\n",
"Image processing refers to a set of operations done on an image in order to efficiently extract information. In this class, we shall understand some of the basic concepts which are relevant, through many Interactives. \n",
"\n",
"In the first section, we understand how a 1-D signal can be reconstructed by adding sinusoidal waves. Later we explore the concepts of frequency spectrum and Fourier Transform. We apply these concepts for 2-D signals, a.k.a Images. Finally, we learn about convolution and the convolution theorem.\n",
"\n",
"To begin everything, let us first look at the simplest signal we can imagine. \n",
"\n",
"## Sinusoidal Waves\n",
"\n",
"The simplest signal is a sinusoidal wave. Sinusoidal waves have three independant parameters. They are: \n",
"* Amplitude, $A$\n",
"* Frequency, $f$\n",
......@@ -29,7 +37,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "068c9312a466412d8e1b6dc582b9e587",
"model_id": "7391fc05a5f043ca87ed4b23169844a5",
"version_major": 2,
"version_minor": 0
},
......@@ -71,8 +79,18 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Processing any piece of data would require a mathematical way to describe these signals. Given that real life data are not simple sinusoids, it would require near infinite amounts of parameters to describe such data mathematically. Fortunately, as we shall see in this course, $all$ data can be expressed as a sum of simple sinusoids. Thus, you learn a powerful way to process real life data with arbitrary precision through this course! "
"Processing any piece of data would require a mathematical way to describe these signals. Given that real life data are not simple sinusoids, it would require near infinite amounts of parameters to describe such data mathematically. Fortunately, as we shall see in this course, $all$ data can be expressed as a sum of simple sinusoids. Thus, you learn a powerful way to process real life data with arbitrary precision through this course! \n",
"\n",
"\n",
"[Next: How can any signal be made up of sinusoids?](ip_basics_part2.ipynb#section_id2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......@@ -91,7 +109,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.6.12"
}
},
"nbformat": 4,
......
This diff is collapsed.
......@@ -6,20 +6,9 @@
"source": [
"## Frequency Spectrum\n",
"\n",
"As we learnt in the last section, any 1-D signal can be split into arbitrary number of sinusoidal waves. We could see in the last graphic the amplitude, frequency and phase of these sinusoidal waves. But, the graphic could only help visualise a small number of waves. For large numbers, it becomes cluttered. \n",
"As we learnt in the last section, any 1-D signal can be split into arbitrary number of sinusoidal waves. In this section, we shall see how to analyse these signals in terms of its frequency. \n",
"\n",
"It is generally preferred to see the strengths of these different frequency components, which is measured by the amplitude. Hence a \"frequency spectrum\" is plotted. This is a graph of amplitude and frequency, leaving out the phase term. As we shall see later on, the phase term is also very important, which is important to remember. \n",
"\n",
"For now, let's consider a simple sine wave\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from misc import *"
"Again, let's consider a simple sine wave having an amplitude 1, frequency 10 and zero initial phase. Run the following code to get the plot\n"
]
},
{
......@@ -51,6 +40,8 @@
}
],
"source": [
"from misc import *\n",
"\n",
"amp,freq,phase = 1,10,0\n",
"w1 = [(amp,freq,phase)]\n",
"signal1,time = addwaves(w1,const=5,tot_time=1,numpoints=1000)\n",
......@@ -63,13 +54,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"This is the simplest signal that we can analyse. This is a cosine wave. The signal is recorded for 1s and has 10 cycles through it, thus it has a frequency of 10 Hz. The average value of the signal is around 5, so this is the DC component of our signal. To find the \"frequency spectra\" of this we can use a \"Discrete Fourier Transform\", which is a mathematical operation given by\n",
"The signal is recorded for 1s and has 10 cycles through it, thus it has a frequency of 10 Hz. The average value of the signal is around 5, so this is the DC component of our signal. To find the \"frequency spectra\" of this we can use a \"Discrete Fourier Transform\", which is a mathematical operation given by\n",
"\n",
"\\begin{equation}\n",
" F_k = \\sum\\limits_{m=0}^{P-1} b(k) \\cdot e^{-2 \\pi i k \\cdot m/P}\n",
" F_k = \\sum\\limits_{m=0}^{P-1} b(k) \\cdot e^{i \\cdot \\frac{-2 \\pi k \\cdot m}{P}}\n",
"\\end{equation}\n",
"\n",
"This gives the $complex$ fourier coefficient of the $k^{th}$ frequency. The magnitude and phase of the wave can be extracted directly from this complex coefficient. Let's see what we get when we plot this:"
"This gives the $complex$ fourier coefficient of the $k^{th}$ frequency. The magnitude and phase of the wave can be extracted directly from this complex coefficient. Run the following code to get the amplitudes at different frequencies. To increase or decrease the frequency range displayed in the x-axis, change the 'flimit' parameter. By default, it is set at 80. "
]
},
{
......@@ -98,9 +89,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Clearly, we see that there is peak at 0 Hz, with a value of 5. The reason for the symmetry is from the mathematics of the DFT process. This results in the 'negative frequencies'. For the purpose of analysis the positive frequencies can be considered only. \n",
"We see that there is peak at 0 Hz, with a value of 5. This is the average value we get by integrating over the whole time period. Integral of a sine wave over full time period is zero, thus the amplitude of frequency spectra at 0 Hz is it's DC power. \n",
"\n",
"We also see that the plot has a symmetry around the 0 Hz line. The reason for this stems from the complex nature of the DFT signal. So the two peaks are the complex conjugates of one another - they have the same amplitude, but opposite phase. \n",
"\n",
"We see a peak at 10 Hz and -10 Hz with a value of 0.5. Together they have a value of 1. This means there is one full cycle of 10 Hz frequency present in our signal, which can be verified easily from above. \n",
"\n",
"The positive frequency at 10 Hz is because the 10 Hz frequency signal is the most dominant. Suppose we add a 20 Hz and 40 Hz signal to the original wave, this is what we get"
"Suppose we add a 20 Hz and 40 Hz signal to the original wave, this is what we get"
]
},
{
......@@ -130,9 +125,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we see peaks at 10 Hz, 20 Hz and 40 Hz as well! \n",
"Now the signal looks complicated. We can't know which frequencies are present in the signal just by looking at it's time varying plot. The frequency spectrum on the other hand, clearly show distinct peaks at 10 Hz, 20 Hz and 40 Hz! \n",
"\n",
"An important point to consider while using the DFT is the relation between co-ordinate index of the frequency spectra and it's frequency. Each co-ordinate index in the frequency spectra corresponds to a specific frequency. The mapping between the index and frequency must be well understood. \n",
"\n",
"\n",
"The fourier transform operation gives the output as an array. The array indices must be mapped on to the correct frequency values. This is done using the sampling frequency and the total number of samples. \n",
"\n",
"sample spacing = time/number of samples\n",
"\n",
......@@ -145,7 +142,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now try changing frequencies of the waves and see how they shift! "
"Now try changing these amplitudes and frequencies yourself and observe how the frequency spectrum changes!"
]
},
{
......@@ -156,7 +153,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "947bbafc03df4312bc3846f57a781e41",
"model_id": "332e129a045c44879ffa61f170b2d12c",
"version_major": 2,
"version_minor": 0
},
......@@ -183,11 +180,14 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": []
"source": [
"In the next section, we dive into 2D signals, or Images. We shall apply these concepts for such signals as well. \n",
"\n",
"[Prev: Fourier Series](ip_basics_part2.ipynb#section_id2) \n",
"[Next: 2-D Fourier Analysis](ip_basics_part4.ipynb#section_id2)"
]
},
{
"cell_type": "code",
......@@ -213,7 +213,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.6.12"
}
},
"nbformat": 4,
......
......@@ -4,31 +4,23 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2-D Image Processing\n",
"## 2-D Fourier Analysis\n",
"\n",
"Now that we considered 1-D signals and how the Fourier Transforms of those look like, let us move to signals which vary across two dimensions. An image taken by a digital camera is the most common example of a 2D signal. \n",
"\n",
"What do we mean when we say that an image is a 2-D signal? It means, essentially that an image is nothing but a matrix of numbers. We can actually see this matrix in any data management software like Python, Excel or Matlab. \n"
"### Image as a 2D Signal\n",
"What do we mean when we say that an image is a 2-D signal? It means, essentially that an image is nothing but a matrix of numbers. We can actually see this matrix in any data management software like Python, Excel or Matlab. Run the following interactive to see the numbers yourself. Move the small rectangle around and check the variation of the numbers. "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from misc import *"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "efd53eb1622941d7b0296342a172f422",
"model_id": "bc75c90f3ea54246b8e161d0ee67f274",
"version_major": 2,
"version_minor": 0
},
......@@ -45,12 +37,14 @@
"<function misc.display_df(Image, i, j, box)>"
]
},
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from misc import *\n",
"\n",
"I = rgb2gray(plt.imread('cameraman.bmp'))\n",
"get_pixel_values(I)"
]
......@@ -59,17 +53,20 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Have a look at this image. Move the black rectangle around and see the numbers which form the image at this location. "
"Each number in this matrix represents a 'pixel value'. When recording an image, photons excites several pixels in a detector and the resulting pattern is what we call an image. For image analysis, the pixel size is important as we shall see later. \n",
"\n",
"Next, we shall try to understand the concepts of spatial frequency and how the 1D analysis we did before applies to images. \n",
"\n",
"[Prev: Frequency Spectrum](ip_basics_part3.ipynb#section_id2) \n",
"[continue: 2-D Fourier Analysis](ip_basics_part5.ipynb#section_id2)"
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"source": [
"Each number in this matrix represents a 'pixel value'. When recording an image, photons excites several pixels in a detector and the resulting pattern is what we call an image. For image analysis, the pixel size is important as we shall see later. \n",
"\n",
"Next, we shall try to understand the concepts of spatial frequency and how the 1D analysis we did before applies to images. "
]
"outputs": [],
"source": []
}
],
"metadata": {
......@@ -88,7 +85,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.6.12"
}
},
"nbformat": 4,
......
......@@ -4,31 +4,23 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Frequencies in space\n",
"* Frequencies varying along space\n",
"* Fourier Spectra of spatial images\n",
"* Fourier Decomposition of images"
"## 2-D Fourier Analysis\n",
"\n",
"In this section, we shall explore the concept of 2-D Fourier Analysis a little more deeper. First, let's take a step back and look at waves in 2-D, and how they reflect on the 2-D Frequncy Spectrum (or sometimes, Fourier space)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Frequencies varying along space\n",
"How does a sinusoidal wave look when varying along 2 dimensions. The equation of the wave is:\n",
"### Frequencies varying along space\n",
"The equation of the wave in 2-D is:\n",
"\n",
"\\begin{equation}\n",
" f(x,y) = A \\cdot sin(2 \\pi f_x \\cdot x + 2 \\pi f_y \\cdot y + phase)\n",
"\\end{equation}\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from misc import *"
"\\end{equation}\n",
"\n",
"Run the following Interactive to change the amplitude, phase, and frequencies in x and y direction of this 2-D wave. Running a DFT algorithm on a 2-D signal can be very time consuming, and hence the frequency spectrum are all calculated using the Fast Fourier Transform algorithm, implemented in the numpy package, <i>np.fft.fft2()</i>"
]
},
{
......@@ -39,7 +31,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6ae77651a4ba4e1dba40de7ca93ea109",
"model_id": "737e78fbafc54813b335578c5085c119",
"version_major": 2,
"version_minor": 0
},
......@@ -62,6 +54,7 @@
}
],
"source": [
"from misc import *\n",
"plot_2D_wave()"
]
},
......@@ -69,16 +62,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"How does the frequency spectra of an image look like? \n",
"\n",
"Here it is!\n",
"The Fourier space in 2-D is also symmetric and the two points are simply the complex conjugates. Hence they move in opposite directions. Let us now look at the Fourier Spectrum of a real image. \n",
"\n",
"In the center, you find the magnitude of the Fourier Transform of the image while on the right you can see the phase spectra. \n"
"Run the following code. In the center, you find the magnitude of the Fourier Transform (amplitude spectrum) of the image while on the right you can see the phase of the Fourier transform (phase spectrum). \n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [
{
......@@ -104,26 +95,18 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now that we know an image can be represented as as Fourier Spectra, just like we did for 1-D signals, we can reconstruct an entire image by adding different frequencies\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Each point on the Fourier Spectra corresponds to a wave in the real space. As we mentioned before, the wave has three parameters: Amplitude, Frequency and Phase. In the following interactive, move the red star to different position on the Frequency Space to see the corresponding wave in real space.\n",
"\n"
"The bright streaks in the amplitude spectrum show the different angled lines which are dominant in the image. As explained before, each points in the spectrum corresponds to a wave in real space. This can be visualised better in the following Interactive. Move the red star around the spectrum to see the corresponding wave in real space. \n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "870d387bd84843ffa6ee5a255aac0884",
"model_id": "e884d494dd6b4f3ab34fa99a65f06a77",
"version_major": 2,
"version_minor": 0
},
......@@ -140,7 +123,7 @@
"<function misc.get_fourierwave(fft, i, j, return_label=False)>"
]
},
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
......@@ -153,7 +136,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Since we know we can add waves to reconstruct a signal, let us now see the effect of adding individual waves selected over a range on the final signal.\n",
"### Reconstruction of 2-D signals\n",
"Since we know we can add waves to reconstruct a signal, let us now see the effect of adding individual waves selected over a range on the final signal. This is similar to how we reconstructed different 1-D sine waves to get any 1-D signal. \n",
"\n",
"In this interactive, all the points inside the rectangle are used to obtain several waves in real space. These waves are added together to get the final output on the left. "
]
......@@ -166,7 +150,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "da4fd509353d4987a0fd1de3179b7227",
"model_id": "c24a66774bd346a2b9e55cd4bf3c07ac",
"version_major": 2,
"version_minor": 0
},
......@@ -196,20 +180,20 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"As you might have observed, adding each individual waves will give the final image as an output. However, this process of adding waves is time consuming. Thus, an efficient method to perform the same operation is using Inverse Fourier Transform. \n",
"As you might have observed, adding each individual waves will give the final image as an output. However, this process of adding waves is time consuming. Thus, an efficient method to perform the same operation is using Inverse Fast Fourier Transform algorithm implemented in <i>np.fft.ifft2</i>. \n",
"\n",
"Now, every point on the Fourier Space inside the recangle are retained and the rest are reduced to zero. The whole image is then Inverse Fourier Transformed to get back the real image. Notice any difference between this method and the previous method? "
"To reconstruct every point within the rectangle, all we need to do is make every other point in the Fourier Transform equal to zero except those present inside it. We can then take the Inverse Foureir Transform to get the same output. Run the following code and see how quickly the result is obtained as opposed to the previous method. "
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a93ef79a14f246a49ed47aca2c122d90",
"model_id": "6a63f5bc537b4142a79a77ba03c41853",
"version_major": 2,
"version_minor": 0
},
......@@ -226,7 +210,7 @@
"<function misc.reconstruct_using_ifft2d(fft, ic, jc, boxwidth, boxheight)>"
]
},
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
......@@ -239,22 +223,22 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### What are some of the properties of Fourier Transforms? \n",
"### Properties of Fourier Transforms\n",
"\n",
"These are some important properties of Fourier Transforms that are useful to remember. \n",
"* Translation Property\n",
"\n",
"What happens to the FT if the Image is translated"
"The translation of signals in real space doesn't change the amplitude spectrum. but has an effect on the phase spectrum. This means rearranging pixels of an image (or having a time delay in 1-D signals) does not change the amplitudes of the component frequencies, but alters their phases. \n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "76226aee6a37481eacffb4a6df4e2c4d",
"model_id": "4646d3963c65402695d415643c1f4679",
"version_major": 2,
"version_minor": 0
},
......@@ -271,7 +255,7 @@
"<function misc.shift_image(Image, shiftX, shiftY)>"
]
},
"execution_count": 7,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
......@@ -286,18 +270,18 @@
"source": [
"* Rotation Property\n",
"\n",
"What happens to FT when the image is rotated"
"When the image is rotated along a perpendicular axis, it also rotates both the amplitude adn phase spectrum equally. "
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6b0146d8291d48d786a529e0907b45fa",
"model_id": "c2f69eebd9ec4f9fac552f95991c2b24",
"version_major": 2,
"version_minor": 0
},
......@@ -314,7 +298,7 @@
"<function misc.rotate_image(Image, angle)>"
]
},
"execution_count": 8,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
......@@ -322,6 +306,23 @@
"source": [
"rotation_property(I)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the next section, we shall learn about convolutions, kernels and the convolution theorem. \n",
"\n",
"[Prev: 2-D Fourier Analysis](ip_basics_part4.ipynb#section_id2) \n",
"[Next: Convolutions](ip_basics_part6.ipynb#section_id2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......@@ -340,7 +341,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.6.12"
}
},
"nbformat": 4,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -30,8 +30,13 @@ def get_image(name,size):
if name=='cameraman':
im_in = rgb2gray(plt.imread('cameraman.bmp'))
im_out = resize(im_in,dsize=(size,size))
if name=='thankyou':
im_in = rgb2gray(plt.imread('thankyou.jpg'))
im_out = resize(im_in,dsize=(size,size))
return im_out
def show_these(allplots,fsize=12):
f = plt.figure(figsize=(fsize,fsize))
n = len(allplots)
......@@ -481,6 +486,18 @@ def reconstruct_using_fft2d(fft,ic,jc,boxwidth,boxheight):
ax2.imshow(np.log(ft_magnitude),extent=[xmin,xmax,ymin,ymax])
ax2.plot([jc], [ic],'r*')
print("Time take to reconstruct: "+str(time()-tic)+" s")
def get_amp_and_phase_at_freq(fft,freq):
mask=create_concentric_mask(freq,1,fft.shape)
crop_fft = fft * mask
amps = abs(crop_fft)
phases = np.angle(crop_fft)
length = np.count_nonzero(amps)
amp = amps.sum()/length
phase = phases.sum()/length
return amp,phase,freq
def reconstruct_using_ifft2d(fft,ic,jc,boxwidth,boxheight):
tic = time()
......@@ -686,12 +703,41 @@ def get_padded_kernel(kernel,shape):
bigkernel[istart:istart+kheight,jstart:jstart+kwidth] = kernel
return bigkernel
def demonstrate_conv_theorem(Image,kerneltype,size):
def demonstrate_conv_theorem(Image,kerneltype,size,justshow=True):
kernel = get_kernel_from_type(kerneltype,size)
kernel = get_padded_kernel(kernel, Image.shape)
convoluted = conv_with_mask_using_fft(Image, kernel)
show_these((Image,kernel,np.log(abs(fft(Image))/Image.size),np.log(abs(fft(kernel))/Image.size),convoluted))
if justshow:
show_these((Image,kernel,np.log(abs(fft(Image))/Image.size),np.log(abs(fft(kernel))/Image.size),convoluted))
else:
return convoluted
def convolution_theorem(Image):
dict_ktype = [('Sharpen','sharpen'),('Box blur','box'),('Gaussian blur','gaussian')]
interact_manual(demonstrate_conv_theorem,Image=fixed(Image),kerneltype=dict_ktype,size=IntSlider(value=3,min=3,max=51,step=2),inputkernel=fixed(None))
\ No newline at end of file
interact_manual(demonstrate_conv_theorem,Image=fixed(Image),kerneltype=dict_ktype,size=IntSlider(value=3,min=3,max=51,step=2),justshow=fixed(True))
def get_timings_convolution_theorem(Image,kerneltype,size):
tic=time()
fft_convoluted = demonstrate_conv_theorem(Image,kerneltype,size,justshow=False)
time_fft_convoluted = time()-tic
toc = time()
kernel = get_kernel_from_type(kerneltype,size)
conv2d_convoluted = conv_with_mask_using_conv2d(Image,kernel)
time_conv2d_convoluted = time()-toc
print("Time take for FFT algorithm: "+str(time_fft_convoluted)+" s \n"+"Time take for Convolution algorithm: "+str(time_conv2d_convoluted)+" s \n")
show_these((Image,fft_convoluted,Image,conv2d_convoluted))
def compare_fft_convolve(Image):
dict_ktype = [('Sharpen','sharpen'),('Box blur','box'),('Gaussian blur','gaussian')]
interact_manual(get_timings_convolution_theorem,Image=fixed(Image),kerneltype=dict_ktype,size=IntSlider(value=3,min=3,max=51,step=2))
def finale():
Image = get_image('thankyou',256)
plt.imshow(Image)
print(":)")
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment