23

Geometric Process

Embed Size (px)

DESCRIPTION

The First lesson bout geometric process

Citation preview

Page 1: Geometric Process
Page 2: Geometric Process

Digital Image Processing, 3nd Ed, Gonzalez & Woods.

Simplified Approach to Image Processing, Crane.

Page 3: Geometric Process

Point Process

Area Process

Geometric Process

Frame Process

Page 4: Geometric Process

Geometric Process

Basic Geometric Process

Forward and Reverse Mapping

Minification only Techniques (Median and Average)

Scaling (Zoom-in and Zoom-out)

Rotation (270, 180, 90 degree)

Translation

Mirroring (Horizontal and Vertical)

Page 5: Geometric Process

Geometric process modify

the arrangement of pixels

based on some geometric

transformation.

Page 6: Geometric Process

Scale

Rotation

Translation

Page 7: Geometric Process
Page 8: Geometric Process

Median Representation

Average Representation

Page 9: Geometric Process

Replaces a block of pixels

with its median values.

Page 10: Geometric Process

Represents a block of pixels

with an average of all of the

pixels.

Page 11: Geometric Process

a. Original image

b. Median

c. Average

Page 12: Geometric Process

Image must often be sized to

certain dimensions.

Zoom-in

Zoom-out

Page 13: Geometric Process

for (int x = 0; x < image1.Width; x++)

{

for (int y = 0; y < image1.Height; y++)

{

pixelcolor = image1.GetPixel(x, y);

image2.SetPixel(2 * x, 2 * y, pixelcolor);

image2.SetPixel((2 * x) + 1, 2 * y, pixelcolor);

image2.SetPixel(2 * x, (2 * y) + 1, pixelcolor);

image2.SetPixel((2 * x) + 1, (2 * y) + 1, pixelcolor);

}

}

Page 14: Geometric Process

for (int x = 0; x <= Convert.ToInt32(Math.Round(widthBaru)) ; x++)

{

for (int y = 0; y <= Convert.ToInt32(Math.Round(heightBaru)); y++)

{

//i[0] – i[8]

//averaging

nRed = Convert.ToInt32((pixelR[0] + pixelR[1] + pixelR[2] +

pixelR[3] + pixelR[4] + pixelR[5] + pixelR[6] + pixelR[7] + pixelR[8]) / 9);

nGreen = Convert.ToInt32((pixelG[0] + pixelG[1] + pixelG[2] +

pixelG[3] + pixelG[4] + pixelG[5] + pixelG[6] + pixelG[7] + pixelG[8]) / 9);

nBlue = Convert.ToInt32((pixelB[0] + pixelB[1] + pixelB[2] +

pixelB[3] + pixelB[4] + pixelB[5] + pixelB[6] + pixelB[7] + pixelB[8]) / 9);

if (nRed > 255)

nRed = 255;

else if (nRed < 0)

nRed = 0;

if (nGreen > 255)

nGreen = 255;

else if (nGreen < 0)

nGreen = 0;

if (nBlue > 255)

nBlue = 255;

else if (nBlue < 0)

nBlue = 0;

Color newpixelcolor = Color.FromArgb(nRed, nGreen, nBlue);

image2.SetPixel(x, y, newpixelcolor);

}

}

Page 15: Geometric Process

Rotates an image about its

center pixel through any

given angle.

270 degree

180 degree

90 degree

Page 16: Geometric Process

Rota 270

for (int x = 0; x < image1.Width; x++) { for (int y = 0; y < image1.Height; y++) { pixelcolor = image1.GetPixel(x, y);

image2.SetPixel(y, image2.Height - 1 - x, pixelcolor); } }

Page 17: Geometric Process

Rota 180

for (int x = 0; x < image1.Width; x++) { for (int y = 0; y < image1.Height; y++) { pixelcolor = image1.GetPixel(x, y);

image2.SetPixel(image2.Width - 1 - x, image2.Height - 1 - y, pixelcolor); } }

Page 18: Geometric Process

Rota 90

for (int x = 0; x < image1.Width; x++) { for (int y = 0; y < image1.Height; y++) { pixelcolor = image1.GetPixel(x, y);

image2.SetPixel(image2.Width - 1 - y, x, pixelcolor); } }

Page 19: Geometric Process

Translation is consists of

moving a section of the

image to another location

image. for (int x = 0; x < image1.Width; x++)

{

for (int y = 0; y < image1.Height; y++)

{

if(((x+transX)>=0)&&((x+transX)<image1.Width)&&

((y+transY)>=0)&&((y+transY)<image1.Height))

{

pixelcolor = image1.GetPixel(x, y);

int nX = x + transX;

int nY = y + transY;

image2.SetPixel(nX, nY, pixelcolor);

}

}

}

Page 20: Geometric Process

To mirror an image is to simpl

flip it about the x or y axis.

Horizontal

Vertical

Page 21: Geometric Process

Horizontal mirroring flips an

image about the y-axis.

for (y=0; y<rows; y++)

for (x=0; x<cols; x++)

DestImage[y*cos+x] =

SourceImage[y*cols+(cols-1-x)];

Page 22: Geometric Process

Vertical mirroring flips an

image about the x-axis.

for (y=0; y<rows; y++)

for (x=0; x<cols; x++)

DestImage[y*cos+x] =

SourceImage[(rows-1-y)*cols+x)];

Page 23: Geometric Process

Point Process

Area Process

Geometric Process

Frame Process