Ch. 5 Test Flashcards

(72 cards)

0
Q

Objects can manipulate…

A

Digitally encoded images and sounds

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

Objects give programmers…

A

Access to complex behavior

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Until 20 years ago, computers mostly…

A

Processed numbers and text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Digital image processing includes:

A
  • capturing images with scanners and cameras
  • representation and storage of images in efficient file formats
  • construction of algorithms used in image-manipulation programs (like photoshop)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

(The essential properties of images) When an image is loaded in a program…

A

The bits map into a rectangle of colored dots (pixels)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

(The essential properties of images)

The coordinates of the grid range from:

A
  • (0,0) at the upper right corner to (width-1, height-1) at the lower right corner
  • width and height are the dimensions in pixels
  • x-coordinates increase positively to the right, y-coordinates increase positively to the bottom.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

An image consists of…

A

A width, height, and a set of pixels

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Each pixel is accessible by…

A

It’s (x,y) coordinates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A pixel contains…

A

Integer values that represent color in terms of RGB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The pixel at the upper left corner is at…

A

(0,0)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Image manipulation operations:

A

Transfer images to and from files and storage in RAM

After loading into RAM, can retrieve or modify a pixel at any grid position

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Image manipulation operators allow the program to

A

Rotate an image
Convert color to gray scale or add filters
Highlight blur or sharpen all or part of an image
Control brightness and perform edge detection
Enlarge or reduce size and apply color inversion
Morph an image into another image

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The images package defines classes that allow the programmer to

A
  • load an image from a file
  • view the image in a window
  • examine and manipulate an image’s pixels
  • update the window with changes
  • save the image back to a file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

APImage and Pixel classes:

A

The two most important classes in the images package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

APImage method includes

A

Creating an image from a file or a blank image
Returning images height and width
Saving the image

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The pixel class…

A
Represents a pixel
-an object of this class contains three integer values to represent the pixels RGB components
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Simple image processing program

A

A program that loads an image from its file and draws it in a window

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

The first statement of a simple image processing program

A

Imports the relevant class, APImage, from the images package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The second statement of a simple image processing program

A

Uses object instantiation to make a new object available to the program and instantiates the class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The third statement of a simple image processing program

A

Runs the draw method on the object to display it in a window

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Java might raise an error if…

A

There is not enough ram to hold an image

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Heap space

A

The area of ram reserved for Java objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

To prevent a crash…

A

Adjust the heap space for data memory using the Xmx command-line option

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Object based programming uses..

A

Existing classes objects and methods to solve problems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
To use an object the programmer must know...
It's interface (the set of methods it recognizes)
25
An interface contains:
The headers of methods and supporting comments about their use (including methods' names, types of parameters they expect, and types of values they return, if any) No info about how methods work is provided
26
Application programming interface
The set of interfaces in a package or language
27
Mutators
Methods that do not return a value - used to modify the internal contents of an object - setPixel and setRed
28
Accessors
Methods that return values - allows users to examine part of an objects contents - toString() returns a strong representation of the data combined in an object
29
Constructors don't have a..
Return type
30
A constructor is called when...
A new object of a given class is created or instantiated
31
Some constructors can receive info in the form of...
Parameters from the caller
32
Default constructor has no..
Parameters | When used the objects internal state is given reasonable default values
33
getWidth and getHeight return...
The width and height of an image
34
When a variable that refers to an object is passed as a parameter to system.out.print or println the method automatically...
Calls that object's toString method to obtain its string representation
35
A simpler way to print the string representation of the image
System.out.println(image)
36
The method getPixel returns..
The pixel object at the given coordinates
37
You can use setPixel method to...
Replace an RGB value at a given position in an image
38
An enhanced for loop or for-each loop:
Assumes you want to visit each element in the data structure for some purpose On each pass the loop variable picks up the next available element in the data structure
39
Linear loop structure
Visit each element in a sequence or count a through a sequence of numbers using a single loop control variable
40
Nested loop structure
Each data value in a two dimensional pixel grid is accessed using the form(, )
41
A nested loop structure must consist of...
An outer and an inner loop | Each loop has a different control variable that iterates over a different coordinate
42
Clone method
Builds and returns a new image with the same attributes as the old one with an empty string as the file name so the two are independent
43
Edge detection:
Performs the inverse function on a color image Removes full colors to uncover the outlines of objects in an image Plays a critical role in object recognition, which detects images in objects Detects edges by looking at luminance of pixels (average of RGB values)
44
If a pixels luminance differs significantly from its neighbors...
It is an edge and the pixel is set to black
45
Reducing an images size can..
Improve its performance (faster loading on a web page. Less space occupied in storage) If height and width are reduced by N, the number of color values is reduced by N^2
46
Size reduction preserves an image's...
Aspect ratio but it throws away some of the pixel info (human eye can't detect this loss)
47
To increase size
Pixels have to be added - approximate color values that would be there if the image was taken at a higher resolution - blending the new and old pixels is a complex process Picture turns blurry
48
Programs do not have to display an image in a
Window | Can load transform and resave an image
49
Save method
Overwrites current file with changes
50
.saveAs does what..
Creates a new file
51
A simple way to shrink an image
Create a new image whose width and height are a fraction of the original
52
To use the images package without a drawing window:
Run from a terminal command prompt
53
Sounds are prepared for computer processing using..
An analog to digital converter | (Samples a sound thousand of times per second, each analog input is assigned an integer
54
How are digital sounds and images different
Sample values are arranged in a linear sequence, not a grid Sound samples are atomic. Each records a sounds volume at a given moment A sequence of sound samples approximates the waveform of the analog sound information (positive values above horizontal axis, negative below)
55
Digital sounds' simple former make their...
Algorithms easier to design
56
Programs that compose or edit music:
Increase or decrease volume Dampen hiss or remove static Remove or insert segments of other sounds Blend sounds, add echoes, or repeat (loop) a sound
57
File formats for sound:
Wav, au, aif, MP3
58
A higher sampling rate leads to:
A better sound and larger file
59
Sample size:
Value in bits represent the range of possible integer sample values(amplitudes)
60
Number of sound channels:
Stereo(two), mono(one) | There can be six channel sound (modern DVDs for example)
61
Sound package
Supports a gui in which sound clips can be manipulated (record new clips, open clip files, save sound clips in files, and play a loaded clip) and methods for writing programs that manipulate sound clips and display the gui
62
APSoundClip
Represents sound as a list of sample objects
63
Sample
A single 16- but signed integer
64
Volume is reflected in:
Amplitude (height and depth) of a sound clip waveform at a given point
65
To increase or decrease volume..
Increase or decrease the size of the sample value (algorithm resets the value of each sample by multiplying its old value by a given factor, greater than 1 volume increases and vice versa)
66
Adjusting a sound clips volume:
Must address possibility that samples fall out of the legitimate range - use the max of the product and the min possible sample if the sample is negative - use the min of the product and the max if the sample is not negative
67
Splicing
Places one clip after another two form a new sound. New clip represents the concatenation of two other clips. A loop visits each sample in a clip and copies its value to the appropriate sample and position in a new sound clip.
68
composing sound clips
Blending two sound clips to form a new clip so that they play simultaneously (must account for unequal length for clips)
69
Echoing sound clips
An effect where an earlier part of a clip is heard concurrently with the sound at the present Algorithm retrieves samples that occur earlier in the clip and blend with sounds that occur later (the inputs are a sound clip and an integer delay. The resulting sample is a new clip)
70
Obvious echo
Has delay between sample pairs
71
Summary
Mr fung's notes