Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical...

67
Ex-Dean, Faculty of Engineering, Technology & Management Professor, Department of Computer Science & Engineering University of Kalyani Kalyani, Nadia, West Bengal E-mail: [email protected], [email protected] Mobile:91 9434352214 Prof.(Dr.) J. K. Mandal

Transcript of Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical...

Page 1: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Ex-Dean, Faculty of Engineering, Technology & Management

Professor, Department of Computer Science & Engineering

University of Kalyani

Kalyani, Nadia, West Bengal

E-mail: [email protected], [email protected]

Mobile:91 9434352214

Prof.(Dr.) J. K. Mandal

Page 2: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 3: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Visible light: a narrow band of

electromagnetic radiation →

380nm (blue) - 780nm (red)

Wavelength: Each physically

distinct colour corresponds to

at least one wavelength in this

band.

Pure Colours: Pure or

monochromatic colours do not

exist in nature.

Page 4: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Example:

Page 5: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

The lighting conditions of the scene have a large

effect on the colours recorded.

Image taken lit by a flash. Image taken lit by a

tungsten lamp.

Page 6: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

The following four images of the same scene were

acquired under different lighting conditions:

Page 7: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

The size of an image is determined directly from

the width M (number of columns) and the height N

(number of rows) of the image matrix I.

Page 8: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

The resolution of an image specifies the spatial dimensions

of the image in the real world and is given as the number of

image elements per measurement; for example, dots per

inch (dpi) or lines per inch (lpi) for print production,or in

pixels per kilometer for satellite images.

Page 9: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 10: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 11: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

A vectorial image has a vector at each pixel. For color

images, these vectors each have 3 components.

Vectorial images with larger numbers of components also

exist, e.g. in satellite imagery.

There are two ways one can process vectorial images:

Marginal processing.

Vectorial processing.

f (x, y) {0,1,…, N} f (x, y) [ {0,…,N}, {0,…,N}, {0,…,N} ]

Gre

ysc

ale

Co

lou

r

Page 12: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Scalar process.Red

Scalar process.Green

Scalar process.Blue

Red

Green

Blue

Each channel is processed separately:

Page 13: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Red

Green

Blue

Vectorialprocess.

Red

Green

Blue

The colour triplets are processed as single units:

Page 14: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Various other colour representations can be

calculated from the RGB representation.

This can be done for:

Decorrelating the colour channels:

principal components.

Bringing colour information to the fore:

Hue, saturation and brightness.

Perceptual uniformity:

CIELuv, CIELab, …

Page 15: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

RGB (CIE), RnGnBn (TV - National Television Standard

Committee)

XYZ (CIE)

UVW (UCS de la CIE), U*V*W* (UCS modified by the CIE)

YUV, YIQ, YCbCr

YDbDr

DSH, HSV, HLS, IHS

Munsel colour space (cylindrical representation)

CIELuv

CIELab

SMPTE-C RGB

YES (Xerox)

Kodak Photo CD, YCC, YPbPr, ...

Page 16: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

These spaces use a cylindrical (3D-polar) coordinate

system to encode the following three psycho-visual

coordinates:

Hue (dominant colour seen)

Wavelength of the pure colour observed in the signal.

Distinguishes red, yellow, green, etc.

More than 400 hues can be seen by the human eye.

Saturation (degree of dilution)

Inverse of the quantity of “white” present in the signal. A pure

colour has 100% saturation, the white and grey have 0% saturation.

Distinguishes red from pink, marine blue from royal blue, etc.

About 20 saturation levels are visible per hue.

Brightness

Amount of light emitted.

Distinguishes the greylevels.

The human eye perceives about 100 levels.

Page 17: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Tagged Image File Format (TIFF)

Graphics Interchange Format (GIF)

Portable Network Graphics (PNG)

JPEG

Exchangeable Image File Format (EXIF)

Windows Bitmap (BMP)

Portable Bitmap Format (PBM)

Page 18: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

max = sup(R, G, B) min = inf(R, G, B)

L = max

If Ht <0,Ht :=Ht +6

H = Ht 60

-

=

otherwise0

0 if maxmax

minmax

S

=+

=+

=

=

--

--

--

maxB

maxG

maxR

H

minmaxGR

minmaxRB

minmaxBG

t

if4

if2

if

Page 19: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Example

Digital camera back display

showing a histogram overlay.

Page 20: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 21: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Three very different images with identical histograms.

Page 22: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 23: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 24: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 25: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 26: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 27: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Cover Image Stego - Image 3/17/2015 27Email: - [email protected]

Page 28: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

3/17/[email protected],

[email protected] 28

Problem

Page 29: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Transmitted through network

We are Indian. We are

proud for our country. We

always like to look ahead

with positive attitude and

giving maximum effort to

growth our country. We are

so much strong in science

and Technology.

We are Indian. We are

proud for our country. We

always like to look ahead

with negative attitude and

giving minimum effort to

growth our country. We are

so much weak in science

and Technology.

Authentication Required

Page 30: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 31: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

This is a simple tutorial designed to give a

brief overview of the GIMP image editing

software.

Please read the GIMP 2.2 Review before

proceeding with the tutorial for

background and general information on

layers and other features:

http://www.pages.drexel.edu/~maw64/white_product_review.doc

There are many more advanced features

that are available for dynamic image

creation. These are not covered in this

tutorial, but more information can be

found on the GIMP website:

file:///C:/Program%20Files/GIMP-2.0/share/gimp/2.0/help/en/index.html

Page 32: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

GIMP is a freely distributed piece

of image manipulation software

available for download at

http://www.gimp.org/

It is available for use on UNIX,

Windows and MacOSX operating

systems

Please note that the help files

must be downloaded and installed

separately from the main program

Page 33: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Help files can be accessed at any timeduring use by pressing the F1 key.

Help on specific menu items can beaccessed by pressing the F1 key whilethe mouse focuses on the menu item.

You can undo any action simply bypressing Ctrl-Z

Mousing over many of the tools andoptions will display a brief narrative ofwhat action it will perform.

Page 34: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

When you start the

program you will

see one to several

separate windows,

or dialogs. The main

toolbox and tool

options is shown at

the right.

Page 35: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Dialogs can be placed together in one window, or dock, or separately in their own windows.

To undock dialogs, click on the „drag handle‟, and drag and drop to the desired position.

Click in this

area, the „drag

handle‟, and

drag and drop

dialogs out of

docks to

create your

personalized

program

layout.

Page 36: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

To dock dialogs, click the „drag handle‟, and drag and drop it onto a „docking bar‟.

The only dialog that cannot be docked with other dialogs is the main image window.

This is the

„docking bar‟

area. Dialogs can

be placed

together in one

window, or dock,

by dragging and

dropping them

onto „docking

bars‟.

Page 37: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

There are five basic dialogs:

1. The Main Toolbox

2. Tool Options

3. An Image Window

4. Layers Dialog

5. Brushes/Patterns/Gradients

Page 38: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

1

2

3

1. Toolbox Menu

• Use these menus to open a new image dialog, load an

image from file or other source, set preferences for

the GIMP layout and performance, open and close

dialogs, and access many other more advanced

features.

2. Tool Icons

• This is where you will find many paint and image

manipulation tools.

3. Foreground/Background Colors

• This displays the current foreground and background colors for

the working image. Clicking on either of them will bring up a

color palette where you can select a new color. The small

symbol in the lower left corner will reset them to black and

white.

• The double-headed arrow can be clicked to swap the

foreground and background colors

4 4. Brush/Pattern/Gradient

• Clicking on any of these areas will bring up a dialog where

you can change any of these features.

• The top left corner shows the currently selected brush for

all paint operations.

• The top right corner show the currently selected pattern

used to fill in selected areas of the image.

• The bottom area is used to set the gradient, when you want

to smoothly transition a range of colors.

Page 39: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

The tool options dialog shows

options for the currently selected

tool (be it a paintbrush, pencil, or

other).

In this case, the brush selected is

a circle, with 100% opacity.

There are many more advanced

options available through the

Mode drop-down menu

Tool Schemes:

1. This button is used to save your

tool option scheme so it can be

loaded and used again at a later

time.

2. When you have one or more tool

schemes saved, you can load

them using this button.

3. This will delete a selected tool

scheme.

4. Clicking this button will reset the

tool options to the default values.

1 2 3 4

Tool scheme buttons

Page 40: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Each image you open will be displayed in a separate window.

1

1. Image Menu

• From this menu you can access almost every

action you can perform on an image, including

those found in the main toolbox, tool options and

other dialogs.

2. Ruler

• This is useful for creating guides to place

components of your image accurately where you

want them.

• By default, the units displayed are in pixels. This

can be changed to inches or other units by

clicking the units menu in the lower left corner

(3).

2

3 4 4. Zoom

• Use this to zoom in and out of your image.

• There are many other more advanced options available through the image window that

will not be covered in this basic tutorial. Once you have mastered basic image editing

techniques, you can learn more about these features using GIMP’s help key, F1.

Page 41: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Layers of an image act

like a stack of

transparencies or

slides; as you add

additional layers, your

final image is a

composite of all of the

layers together.

You can select which

layer you want to work

on by clicking on its

name in (1)

The opacity of the layer

can be easily changed

using the slide bar or

menu at (2)

(3) can be used to open

a new layer

The arrow buttons at (4)

can be clicked to move

up and down the stack

of layers

(5) can be clicked to

duplicate a layer

(6) is used to delete a

layer

1

2

3 4 5 6

Page 42: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Just a reminder: any of these dialogs can be

opened or closed through the main toolbox

dialog, by selecting File -> Dialogs

• These dialogs can be used to select

brush type, patterns and gradients.

•Many of these features can also be

accessed through the main toolbox.

•The button options at (1), (2) and (3)

are similar to those of other dialogs.

They can be used to modify, delete,

duplicate and/or reset the brushes,

patterns and gradients.

1

2

3

Page 43: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

1. To create a new image,

from the main toolbox

select File -> New

2. The Create a New Image

window will open, where

you can select the

height and width of the

image, and resolution.

3. The units for the height

and width can be

changed by clicking on

the units menu (1)

4. The resolution of the image can be changed by clicking (2), or selecting Advanced Options (3).

5. For our purposes, we will use the default resolution of 420 x 300 pixels, 72 dpi, RGB color.

6. Click OK (4) to open your new image window.

1

2

3

4

Page 44: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

1. To open an existing image from file for editing, select File -> Openfrom the main toolbox.

2. The Open Image will appear. Find your image on your computer using the navigation area (1). This is quite similar to the navigation used by many other programs.

3. A preview of the image will appear in the preview pane (2).

4. When you have found the desired image, click the Open button (3) and it will open in a new image window.

1

2

3

Page 45: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

The crop tool can be used to remove unwanted areas from an image.

1. Click on the crop tool in the main toolbox.

2. In the image dialog, click and drag out a rectangular region. Release the mouse, and a crop dialog will appear.

3. You can change the dimensions within the crop dialog, or re-click and drag until you have the portion selected you wish to keep.

4. Click OK in the crop dialog. The unwanted region is now gone from your image.

Crop

tool

Click and drag to select

the area you want to keep.

After clicking OK, your

image will be cropped.

Page 46: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

1. Click on the hand-drawn tool from the main toolbox.

2. In your image, click and drag around the portion of the image you wish to modify.

3. When you release the mouse, your selection has been made.

4. Right-click the image to bring up a variety of tools and options for modifying your selection. You can perform any number of actions- play around with it and see what you can do! Remember Ctrl-Z will quickly undo any action.

5. I have cropped this image so that the background is removed by copying and pasting my selection into a new image window.

Hand-

drawn tool

•If you wish to perform operations on a specific part

of an image, or crop a region of free-form shape the

hand-drawn selection tool can be very useful.

Click and drag around the object to

make a selection. Right-click to

brink up option menus for

modifying the selection.

I have removed the

background of this image.

Page 47: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Most of these tools are common in all image editing and paint programs

The pencil, brush, airbrush and pen can be selected to draw on your image

The paint bucket is used to fill an area in with a selected color or pattern

The large „T‟ can be clicked to insert text into an image

The eraser is used to erase portions of an image

Reminder: You can always mouse over an item for a short text

description, or press F1 while the mouse is centered over the

item to access online help documentation.

Page 48: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Script-Fu makes

creating uniform

components for your

website easy.

From the main

toolbox, select Xnts ->

Script-Fu, and select

any one of the options

for buttons, logos or

other items.

Page 49: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Select the Buttons option in the Script-Fu menu and a dialog will open

Here you can specify the text of the button, the font size and type, the color selection and various other options for active and inactive buttons.

Click OK to create your button(s).

You are now free to save them in the format desired and implement them in your web page!

Page 50: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

From the Script-Fu menu select Logos, and choose from one of the many special effects to be applied to your logo.

GIMP offers almost 30 effects including Neon, Frost, Comic Book, etc..

A Logo dialog will appear, where you can select the text, font, color and other special effects.

Click OK to create your logo.

You are now free to save it in the format desired and implement it in your web page!

Page 51: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

There are many other features available in the

GIMP. Have fun exploring and remember to use

the F1 key!

Ctrl-Z can always undo what you don‟t like!

Page 52: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

IMAGE SCALING:-

•Open an Image

•Open with GIMP

•Click on Image

•Click on Scale image

•Unlock the lock

•Change the height and width

•Click on Scale

•Click on File

•Click on Save as

•Change name(title)

•Change extension (.ppm or .pgm)

•Click on Save

•Click on ASCII

•Click on Save

Page 53: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

/* A 'C' Program To Copy One Image(.pgm)

into Another & Calculate the Header Size*/

#include<stdio.h>

char name[20];

int image[512][512];

int height,width;

void read()

{

char c;

int i,j,value;

FILE *p1;

p1=fopen(name,"r");

i=0;

while((c=fgetc(p1))!=EOF)

{

if(c=='\n')

i++;

if(i==2)

{

fscanf(p1,"%d",&width);

fscanf(p1,"%d",&height);

}

if(i==4)

{

break;

Page 54: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

printf(" ~~~~~Copying is

Started~~~~~");

printf("height=%d",height);

printf("width=%d",width);

for(i=0;i<height;i++)

{

for(j=0;j<width;j++)

{

fscanf(p1,"%d",&value);

//copy values into matrix one by one

image[i][j]=value;

}

}

printf("\n The file is

successfully copied\n");

fclose(p1);

Page 55: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

}

void write()

{

FILE *p2;

int i,j;

p2=fopen("Copy.pgm","w");

fprintf(p2,"%s","P2\n# CREATOR: The GIMP's PNM Filter Version 1.0\n512 512\n255

for(i=0;i<height;i++)

{

for(j=0;j<width;j++)

{

fprintf(p2,"%d\n",image[i][j]);

}

}

fclose(p2);

}

int main()

{

printf("\n\n Enter the Name of the image(.pgm) file :: ");

scanf("%s",name);

read();

write();

return 0;

}

Page 56: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

i/o variable: grayscale image: image[512][512]

name of the image: name[20]

height, width.

Read()

[Open the file pointer into read mode. Read the characters of header and

height and width from the file. Read the matrix elements from file to the

matrix. Close the file pointer. ]

Page 57: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Start

Open input file pointer p1 into read mode.

read characters from p1 to the variable c.

repeat step 5 to step 7 until c is End Of the File.

Check if c is new line

i <- i+1

Check if i=2

Read width and height from p1.

Check if i=4

Break

Print height and width

i <- 0 , j <- 0 (initialize)

repeat step 11 to step 14 until i<height

repeat step 12 to step 13 until j<width

read elements from p1 to value

read elements from value to image[i][j]

j <- j+1

i <- i+1

Close file pointer p1

End

Page 58: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Write()[Open the file pointer into write mode. Copy the header into that pointer.

Print the matrix values into that pointer according to the height and width of

the image and close the file pointer. ]

Start

Open file pointerp2 in write mode

Print the header into p2

i <- 0 , j <- 0

Repeat step 6 to step 8 until i<height

Repeat step 7 until j<width

Print image[i][j] into p2

j <- j+1

i <- i+1

close p2

End

Page 59: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

i/o variable: color image: red[512][512],

green[512][512], blue[512][512]

name of the image: name[20]

height, width.

Read()

[Open the input file pointer into read mode. Read the characters of header

and height and width from the file. Read the matrix elements from file to

the three matrices (red, green and blue). Close the input file pointer. ]

Page 60: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Start

Open input file pointer p1 into read mode.

read characters from p1 to the variable c.

repeat step 5 to step 7 until c is End Of the File.

Check if c is new line

i <- i+1

Check if i=2

Read width and height from p1.

Check if i=4

Break

Print height and width

i <- 0 , j <- 0 (initialize)

repeat step 11 to step 18 until i<height

repeat step 12 to step 17 until j<width

read elements from p1 to value

read elements from value to red[i][j]

read elements from p1 to value

read elements from value to green[i][j]

read elements from p1 to value

read elements from value to blue[i][j]

j <- j+1

i <- i+1

Close file pointer p1

End

Page 61: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Write()[Open three output file pointers into write mode. Print the header of a grayscale image into

those pointers. Print the matrix values into those pointers according to the height and width

of the image and close the file pointers. ]

Start

Open file pointerp2,p3,p4 in write mode

Print the header of a grayscale image into p2,p3,p4 .

i <- 0 , j <- 0

Repeat step 6 to step 8 until i<height

Repeat step 7 until j<width

Print red[i][j] into p2

j <- j+1

i <- i+1

close p2

Repeat step 12 to step 14 until i<height

Repeat step 13 until j<width

Print green[i][j] into p3

j <- j+1

i <- i+1

close p3

Repeat step 18 to step 20 until i<height

Repeat step 19 until j<width

Print blue[i][j] into p3

j <- j+1

i <- i+1

close p4

End

Page 62: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

i/o variable: color image: red[512][512],

green[512][512],blue[512][512]

name of the image: name[20]

height, width.

[Open the input file pointer into read mode. Read the characters of header

and height and width from the file. Read the matrix elements from file to

the three matrices (red, green and blue). Close the input file pointer. ]

Read()

Page 63: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Start

Open input file pointer p1 into read mode.

read characters from p1 to the variable c.

repeat step 5 to step 7 until c is End Of the File.

Check if c is new line

i <- i+1

Check if i=2

Read width and height from p1.

Check if i=4

Break

Print height and width

i <- 0 , j <- 0 (initialize)

repeat step 11 to step 18 until i<height

repeat step 12 to step 17 until j<width

read elements from p1 to value

read elements from value to red[i][j]

read elements from p1 to value

read elements from value to green[i][j]

read elements from p1 to value

read elements from value to blue[i][j]

j <- j+1

i <- i+1

Close file pointer p1

End

Page 64: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Write()

[Open three output file pointers into write mode. Print the header of a color

image into those pointers. Print the matrix values into those pointers

according to the height and width of the image and close the file pointers. ]

Page 65: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:

Write()

Start

Open file pointerp2,p3,p4 in write mode

Print the header of a grayscale image into p2,p3,p4 .

i <- 0 , j <- 0 ,temp <- 0

Repeat step 6 to step 10 until i<height

Repeat step 7 to step 9until j<width

Print red[i][j] into p2

Print temp into p2

Print temp into p2

j <- j+1

i <- i+1

Repeat step 13 to step 17 until i<height

Repeat step 14 to step 16until j<width

Print temp into p3

Print green[i][j] into p3

Print temp into p3

j <- j+1

i <- i+1

Repeat step 20 to step 24 until i<height

Repeat step 21 to step 23 until j<width

Print temp into p4

Print temp into p4

Print blue[i][j] into p4

j <- j+1

i <- i+1

close p2, close p3, close p4

End

Page 66: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates:
Page 67: Prof.(Dr.) J. K. Mandaljkmandal.com/pdf/image_processing_gimp.pdfThese spaces use a cylindrical (3D-polar) coordinate system to encode the following three psycho-visual coordinates: