Upload
muhamad-iqbal-nazarudin
View
10
Download
0
Embed Size (px)
DESCRIPTION
The First lesson bout geometric process
Citation preview
Digital Image Processing, 3nd Ed, Gonzalez & Woods.
Simplified Approach to Image Processing, Crane.
Point Process
Area Process
Geometric Process
Frame 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)
Geometric process modify
the arrangement of pixels
based on some geometric
transformation.
Scale
Rotation
Translation
Median Representation
Average Representation
Replaces a block of pixels
with its median values.
Represents a block of pixels
with an average of all of the
pixels.
a. Original image
b. Median
c. Average
Image must often be sized to
certain dimensions.
Zoom-in
Zoom-out
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);
}
}
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);
}
}
Rotates an image about its
center pixel through any
given angle.
270 degree
180 degree
90 degree
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); } }
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); } }
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); } }
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);
}
}
}
To mirror an image is to simpl
flip it about the x or y axis.
Horizontal
Vertical
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)];
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)];
Point Process
Area Process
Geometric Process
Frame Process