# 2: Introduction to Basic Operations

Now that we have covered the numerical representation and colors of digital images, we can move to some basic image processing operations.

We will be using the lena image, a commonly used image for image processing, in this section.

Sampling involves taking the value of the image at regular spatial intervals. The length of the intervals define the spatial resolution of the image. We define N as the number of pixels per side of the image. The larger the N, the denser the points are and the better the resolution.

Here, samples are taken at N equal to 14, 28, 55, 110, and 220. This means that the image with N=14 has 14 unique shades of color only. Furthermore, the size of the image is reduced as well.

This is used practically in analog pictures by cameras by focusing or un-focusing the lens. In essence, it is the resolution of the image.

2. Quantization deals with binning values. Unlike sampling where the values are removed based on the N resulting in smaller (or bigger) images, the size of the image remains the same and values are replaced by the bin value.

In the case of k=2, there are only 2 bins a color can appear in and in this case, the 2 bins are of colors black and red. With more bins, more color options get unlocked.

The intensity values of the image are therefore discretized by k number of bits to represent an intensity value also known as its bit depth.

3. Color Spaces
We have already discussed about colors in digital images in the previous post so we will look at some color manipulations here.

Taking again the lena image, we will explore some functions for color spaces.