Docsity

Image Processing Techniques: Filtering, Edge Detection, and Feature Extraction - Prof. Sol, Appunti di Computer Graphics

Toggle sidebar
bg1
01 Image formation, processing, edge detection, Hough transform
1
01 - Image formation,
processing, edge detection,
Hough transform
1.1 3D Computer Vision
1.1.1 Some definitions
Letʼs give some basic definitions before delving deep into Computer Vision.
Computer vision
Computer Vision is the process of understanding the "content" of an image by
estimating a "3D model" of the depicted scene. It enables systems to interpret
and interact with the real world through visual information. The unknown is the
3D camera pose.
Computer graphics
Computer Graphics focuses on creating an image from scratch using a 3D
model. This field is dedicated to generating visual content and effects that can
range from realistic simulations to artistic representations. The unknown is the
2D image.
Role of CV and CG in VR and AR
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Anteprima parziale del testo

Scarica Image Processing Techniques: Filtering, Edge Detection, and Feature Extraction - Prof. Sol e più Appunti in PDF di Computer Graphics solo su Docsity!

01 - Image formation,

processing, edge detection,

Hough transform

1.1 3D Computer Vision

1.1.1 Some definitions

Letʼs give some basic definitions before delving deep into Computer Vision.

Computer vision

Computer Vision is the process of understanding the "content" of an image by estimating a "3D model" of the depicted scene. It enables systems to interpret and interact with the real world through visual information. The unknown is the 3D camera pose.

Computer graphics

Computer Graphics focuses on creating an image from scratch using a 3D model. This field is dedicated to generating visual content and effects that can range from realistic simulations to artistic representations. The unknown is the 2D image.

Role of CV and CG in VR and AR

In Virtual Reality, CG is used to create an entirely immersive digital world, while CV tracks the user's actions and position to enable realistic interactions with that virtual space.

Augmented Reality combines CG to enhance the real world with digital content and CV to blend real and virtual elements seamlessly, ensuring they align and interact coherently within the userʼs environment.

1.1.2 Sense of vision

The sense of vision plays an important role in the life of primates because it allows them to infer 3D spatiotemporal properties of the environment starting from 2D sequences of images.

One dimensionality is missed when looking at images compared to the real world. However, that dimensionality is crucial for the interaction with the environment.

The idea is to reconstruct the 3D space starting from a 2D image.

This king of problem is mathematically inverse ill-posed problem because a solution might not exist, or if at least one solution exists, there might be infinite solutions or they might be unstable.

How to solve the problem then?

Some assumptions based on prior knowledge/experience must be done.

segmentation and therefore to distinguish objects.

1.1.4 Objectsʼ distance

To compute the distance between objects, we need to get access to the third dimension.

Therefore, two images from two different POVs are needed. Considering the difference between the distances of the objects we obtain a disparity map.

Calibration of the camera is required, too.

1.1.5 Objectʼs speed

To compute the speed (optic flow) of objects, more than one image is required and in particular we need images from the same POV, but at different time instants.

Note that the speed is computed in pixel/frame. To obtain m/s we need to calibrate the camera.

1.2 Image formation

Before delving deep into understanding how a 3d image is reconstructed, it could be useful to see how 2D images are generated and processed.

1.2.1 Photometry overview

Images form when light from an illumination source strikes a surface, reflecting off it in varying intensities and directions based on the surface's properties.

This reflected light carries information about the surface's texture, color, and shape, which is captured by a visual sensor (like a camera).

The sensor then responds by converting the light into electrical signals, creating a digital representation of the image based on the intensity and color of the reflected light.

Mathematically, the intensity of light at the point is defined as:

where:

is the illumination at the point. Itʼs the amount of source illumination incident on the object. Note that: is the reflectance at the point. Itʼs the amount of illumination reflected by the object. Note that:

1.2.2 Digital image formation system

The digital image formation system consists basically of the optical system, the sensor and the digitizer.

( x , y )

s ( x , y ) = il ( x , y ) r ( x , y )

il ( x , y ) ( x , y )

0 < il ( x , y ) < ∞ r ( x , y ) ( x , y )

0 < r ( x , y ) < 1

A pinhole camera consists of a light-tight box or chamber with a small aperture (the "pinhole") on one side. The opposite side of the chamber is covered by a photosensitive surface, such as film or a digital sensor, where the image is projected.

Although the camera doesnʼt use lenses, we can use similar principles.

The pinhole perspective projection is described as:

where:

is the focal length, or distance from the pinhole to the image plane is the coordinate system in the 3D scene is the coordinate system in the image plane

The equations show how the 3D coordinates of a point are transformed into 2D coordinates on the image plane.

The coordinate serves as a scaling factor, determining how far the point is from the pinhole. As increases (meaning the object is further away), the projected coordinates decrease, leading to a smaller representation on

{ x^ =^ f

′ ′ Z

X y ′^ = f ′ ZY

f ′ ( X , Y , Z ) ( x ′^ , y ′^ , z ′)

P

( x ′^ , y ′) Z Z ( x ′^ , y ′)

the image plane. These equations exemplify the ill-posed nature of the problem: in fact, multiple 3D configurations can produce the same 2D projection.

This is the case of:

Small and near objects vs big and far objects Slow and near object vs fast and far objects

The pinhole camera is not a linear model due to the division by.

However, exploiting the homogeneous coordinates, the model can be also represented as a linear matrix transformation.

The trick is to add one coordinate both to the image and scene coordinates:

In this way, the relation between the world frame (extrinsic) and the image coordinates (intrinsic) can be rewritten linearly as:

Z

Based on this, we can define the depth of field, which is the range of distances within which objects appear acceptably sharp.

In other words, it's the area in front of and behind the focal point that remains "in focus," with any objects outside this range becoming increasingly blurry.

The depth of field depends also on the aperture of the lens:

a smaller aperture (ex. ) results in a larger depth of field, meaning that the range in which the object is approximately in focus is large;

a larger aperture (ex. ) results in a shallower depth of field, meaning that the range in which the object will appear in focus is smaller.

Another important property is the field of view FOV, which is the portion of the 3D space seen by the camera expressed in angular measure.

The FOV is related to the focal distance :

If is smaller, the image becomes more wide angle, so more world points project onto the image plane.

16

f

f

f f

If is larger, the image becomes more telescopic, with only a small portion of the world projecting onto the image plane.

Example:

Note: in virtual reality, the FOV is an important parameter to take into account because, due to the fact that it is typically different than the natural FOV, it can cause cyber sickness.

1.2.6 Visual sensor

The visual sensor transduces the intensity signal into an electric signal.

In digital imaging devices, this two-dimensional signal is processed into a digital image, where each pixel represents the light intensity and color information from the scene.

There are mainly two types of cameras:

Charge-Coupled Devices CCD CCD sensors offer high-quality images with low noise. The architecture of a CCD device:

f

Spatial sampling: the resolution will be higher with a higher number of pixels.

Quantization of the light intensity: the number of levels of intensity must be set due to the fact that we canʼt represent continuous infinite intensity variations.

The result is that images are represented as matrix of integer values indicating the intensity of light.

1.3 Image processing

In image processing, standard operators map pixel values from one image to another, depending on how the output pixel value is determined. These operators can be categorized into three types:

Point operators In point operations, the output pixel value depends solely on the corresponding input pixel value. Example: contrast adjustments Neighborhood operators

In neighborhood operations, the output pixel value is computed using the values of surrounding pixels within a small neighborhood or window. Example: filtering, edge detection Global operators Global operators involve using information from the entire image, rather than just local or individual pixels. Example: histogram, Fourier transform

1.3.1 Mathematical operations

If we consider images and with and , then we can define: Image addition/subtraction

Example of addition:

Example of subtraction:

a ( i , j ), b ( i , j ) c ( i , j ) i = 1, ..., N j = 1, ..., M

c ( i , j ) = a ( i , j ) ± b ( i , j )

is the number of pixels with intensity k = number of possible intensity levels bits for each pixel) intensity values

Contrast stretching enhances image contrast by linearly expanding the range of pixel intensities to cover the full possible spectrum.

The first term normalizes the original pixel value to the range 0,1, based on the minimum and maximum values of the input image. The second term scales the normalized value to the desired output range. And finally, adding the last term shifts the scaled value to the desired output range, ensuring that the minimum value aligns with omin.

nk L (2 , i i = k

b ( i , j ) = (^) a ax − a in ( o − m m

a ( i , j ) − amin max o^ min ) + omin

1.3.5 Warping

Warping is a transformation technique that distorts or reshapes an image or object by applying a mathematical function to adjust its coordinates.

Conversely to traditional filtering, where the range of pixel values is changed, warping changes the domain of image, leaving the intensity of pixels unaltered:

In order to apply warping, affine and geometric transformation can be used:

In inverse mapping, for each pixel in the output image, the algorithm calculates the corresponding position in the input image and assigns the intensity of the nearest input pixel to the output pixel.

Example:

1.3.6 Image interpolation

Interpolation is the process of estimating unknown values by using known data points, commonly used in image processing to calculate new pixel values based on surrounding pixels.

It is typically used when zooming or shrinking an image in order to estimate new pixel values for the resized image.

Moreover, in geometric transformations such as warping, interpolation helps in determining pixel values at non-integer locations when the image is transformed.

( v , w ) = T −1{( x , y )}

Some cameras use interpolation to artificially increase the resolution of an image. In this case interpolation is also called resampling.

1.4 Image filtering

1.4.1 Image neighborhoods

When working with image neighborhoods in image processing, we typically measure properties relative to small regions of pixels, rather than considering the entire image at once.

Neighborhoods are important because images are structured as grid of pixels and the meaning of each pixel depends on its relationship with neighboring pixels. Itʼs the spatial arrangement of pixels that gives the image a meaning, not the individual pixel values.

In fact by shuffling the pixel values we disrupt images, but the histogram remain unchanged.

1.4.2 Convolution

Convolution is a mathematical operation used in image processing to apply filters to an image, modifying its pixel values based on the surrounding neighborhood.

It involves a kernel (filter) that slides over the image, performing weighted sums of the pixel values:

Example: