Posts

Analyzing Images in Fourier Space

Image
Last activity, we played around with images in Fourier space. Given a periodic function \(f(t)\) with fundamental period \(T\) such that \(f(t+T)=f(t)\) that has a finite number of finite discontinuities and finite number of extreme values within the interval \([a,a+T]\) for all \(a\in\mathbb{R}\), then \(f(t)\) can be rewritten as: \begin{equation}\label{fseries}f(t)=\dfrac{a_0}{2}+\sum_{n=1}^\infty a_n\cos(nt)+\sum_{n=1}^\infty b_n\sin(nt)\end{equation} [1]. This means that any periodic function, or signal, can be decomposed as a sum of sines and cosines of different frequencies with different contributions. To get the contribution of each frequency of sines and cosines to get \(f(t)\), what we can do is to obtain its Fourier transform, \(\mathscr{F}\{f(t)\}=F(\omega)\) given by: \begin{equation}\label{1d_ft}F(\omega)=\int_{-\infty}^\infty f(t)\mathrm{e}^{-\mathrm{i}2\pi\omega t}\,\mathrm{d}t\end{equation} [2]. This can even be extended to work for functions dependent on two func...

Estimating Areas in Images

Image
Last lab session, we were told that we can estimate areas of shapes found in images - nice! To do so however, we had to make use of the consequence of a very mathematical thing - Green's Theorem. It's been very long since I last seen this kind of math so please let me do so here. Green's Theorem states that if you have two functions \(M(x,y)\) and \(N(x,y)\) which have continuous first partial derivatives on a region \(R\) in a plane, then if the curve \(C\) bounding \(R\) is a sectionally smooth simple closed curve in that plane, then: \begin{equation}\label{green}\iint_R\left(\dfrac{\partial N}{\partial x}-\dfrac{\partial M}{\partial y}\right)\,\mathrm{d}x\,\mathrm{d}y=\oint_C\left[M(x,y)\,\mathrm{d}x+N(x,y)\,\mathrm{d}y\right]\end{equation} [1] This meant that one way to evaluate the integral on the right hand side of \eqref{green} is to evaluate the integral on its left hand side, and vice versa - assuming the conditions on \(M(x,y)\) and \(N(x,y)\) are met. Looki...

Simple Image Enhancement Methods

Image
Last lab session, we were tasked to perform point transformation onto images - where one uses a transformation function \(\mathrm{T}[\ ]\) on an image \(f(x,y)\) to obtain another image \(g(x,y)\), or: \begin{equation}g(x,y)=\mathrm{T}\left[f(x,y)\right]\end{equation} [1]. Specifically, we were told to do the following transforms: image negative, logarithmic and gamma transform, contrast stretching and thresholding, and intensity-level slicing. From [1], we see that given that maximum gray value present in the image \(f(x,y)\) is \(L\), then for all gray level values in \(f(x,y)\) is \(r\), the resulting gray values for \(g(x,y)\) is \(s\), and the image's negative is obtained by: \begin{equation}s=L-r \label{nega}\end{equation} whereas for image's logarithmic transform is given by: \begin{equation}s=c\log(1+r) \label{log}\end{equation} and for gamma transform is: \begin{equation}s=cr^\gamma \label{gamma}\end{equation} To stretch the contrast of an image, we stretch c...

First taste at Image Processing

Image
Last August 15, 2018, we had our first taste at image processing. While we didn't do anything hardcore, it was still fun to do since this was new to us, so the possibilities were endless. The first thing we were told to do was to create 30x30 images, either manually or through programming them. It wasn't really straightforward doing both since we were making .pgm images, a not-so-familiar image file-type that can be edited easily using Paint. A .pgm, or portable gray map image [1], is a very simple image file-type that encodes images using gray values on a scale from 0 to 255 where 0 represents black, and 255 white. Essentially, when encoding or editing .pgm files, all you need to do is to edit the gray scale values of each pixel in the image, and you get your result after saving it. How easy! In our case, we were tasked to create seven images, a dot, outline of a square, cross, filled circle, concentric squares of different gray values, and the first letter of my name whic...

First Post in this Blog

This first semester of AY 2018-19, I am taking App Physics 186 which focuses (I think) on Image and Video Processing. Finally, a course that will help me understand how the popular freeware Tracker  works when I use it to analyze footage taken in our Physics 191/2 courses. As a start to this new blog, I'd like to test whether it is compatible with \(\LaTeX\), and so, I will be adding a few equations. Please don't mind them as it this only assures me that if it works, I know it is working. \begin{align}\label{euler} \mathrm{e}^{\mathrm{i}\,x}&=\sum_{n=0}^\infty\frac{(-1)^n}{(2n)!}x^{2n}+\mathrm{i}\,\sum_{n=0}^\infty\frac{(-1)^{n}}{(2n+1)!}x^{2n+1} \\ \label{fourier} \mathscr{F}\{g(\omega)\}&=\int_{-\infty}^{\infty}f(t)\mathrm{e}^{2\pi\mathrm{i}\,\omega t}\,\mathrm{d}t\end{align} Here, \eqref{euler} refers to the summation form of Euler's Formula, while \(\eqref{fourier}\) refers to a simple Fourier Transform. Another nice equation to note is that to get the \(n...