admin 管理员组

文章数量: 1184232


2024年4月16日发(作者:数据库数据恢复哪家好)

EBU723U – Image and Video Processing – 2009/10

Coursework – Part 1 of 3

Name: _____ZHOU Yuzhu_____

Username: ______ee06b08________

Exercise 1 (a)

Reading/writing PGM/PPM images:

The first step towards image and video processing is reading

images from file and write them to file. There exist different standards that store the information in different

formats; before opening an image, knowledge of the standard is necessary. Two widely used image

formats are PPM and PGM. The PGM format is a greyscale file format designed to be easy to manipulate.

A PGM image represents a greyscale graphic image. For most purposes, a PGM image can just be

thought of an array of integers. The name "PGM" is the acronym of "Portable Grey Map." The name

"PPM" is the acronym for "Portable Pixel Map." Images in this format (or a precursor of it) were once also

called "portable pixmaps." It is a highly redundant format, and contains a lot of information that the Human

Visual System (HVS) cannot even discern. However, as PGM, PPM is very easy to write and analyze. The

goal of the first part of today’s lab is to let students become comfortable with these two formats.

You will implement functions to read and to write PPM and PGM images. The final demonstration of the

implemented software will be done using well-known test images: LENA, BABOON, PEPPERS, etc. You

can find PPM and PGM versions of these images in the ELEM023 intranet pages. The writing function

must add as comment in the header: “image created by your_name your_surname”.

Include in your submission the file resulting from reading the images provided and writing them back in

their original format.

Summarize in 5 points the operations necessary to read a PGM/PPM image:

1. Use function imread to read the PGM/PPM file.

2. The form using this function likes that: A = IMREAD(FILENAME,FMT)

3. The text string FMT specifies the format of the file

4. The return value A is an array containing the image data as M×N for PGM or M×N×3 for PPM.

5. The image can be shown with the function imshow

Summarize in 5 points the operations necessary to write a PGM/PPM image:

1. The function imwrite can be used to write image into graphics file.

2. The form using this function likes that: IMWRITE(A,FILENAME,FMT)

3. FILENAME in the format specified by FMT.

4. A specific parameter ‘Encoding’ which default to be ‘rawbits’ and means binary encoding.

5. The ‘Encoding’ parameter is ‘ASCII’ for plain encoding.

What is the difference between the identifier P3 and P6?

The head part of a image, P3 and P6 both means the type is PPM.

If the header is P3, data of the image will be record as ASCII txt and each line will be less than 70.

If the header is P6, data of the image will be record as bit for each RGB element.

The P6 file is much smaller than the P3.

Use the given spaces for your answers. Do not extend the spaces or change the font-size.

Page 1

Exercise 1 (b)

Format conversions: in this part of the lab, the images will be converted from colour to grey scale; in

other words a PPM image will be converted to the PGM format. You will implement a function called

“BUPT_format_converter” which transforms images from color to grey-scale using the following YUV

conversion:

Y = 0.257R + 0.504G + 0.098B + 16

U = -0.148R – 0.291G + 0.439B + 128

V = 0.439R – 0.368G – 0.071B + 128

What component represents the luminance, i.e. the grey-levels, of an image?

Y represents the luminance (grey-levels), u and v are Chroma.

Use thee boxes to display the results for the colour to grey-scale conversion.

Lena colour (RGB) Lena grey

Baboon colour (RGB) Baboon grey

Is the transformation between the two colour-spaces linear? Motivate your answer

Yes.

Because the transformer is linear matrix, so the transformation between the two colour-spaces linear too.

f(kα+kβ)=kf(α)+kf(β)

Use the given spaces for your answers. Do not extend the spaces or change the font-size.

Page 2


本文标签: 数据库 作者